textarea.vue 635 B

123456789101112131415161718192021222324252627282930313233343536
  1. <template>
  2. <view>
  3. <view class="uni-textarea">
  4. <textarea maxlength="100" @input="bindTextAreaBlur" :placeholder="tips"/>
  5. <view style="color:#909399;text-align:right;">{{numberList}}/100</view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. tips:{
  13. default:'填写催单内容',
  14. type: String
  15. }
  16. },
  17. data() {
  18. return {
  19. numberList: 0,
  20. focus: false
  21. }
  22. },
  23. methods: {
  24. bindTextAreaBlur(e) {
  25. this.numberList = e.detail.value.length;
  26. this.$emit('submitValue', e)
  27. }
  28. }
  29. }
  30. </script>
  31. <style>
  32. .uni-textarea textarea {
  33. padding: 30upx 2% 18upx 2%;
  34. }
  35. </style>