You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

64 lines
1.2 KiB

  1. <template>
  2. <view :style="[{ bottom: inputBottom + 'px' }]" class="cu-bar foot input">
  3. <input
  4. @focus="inputFocus"
  5. @blur="inputBlur"
  6. @input="input"
  7. @confirm="sendClick"
  8. :value="value"
  9. :adjust-position="false"
  10. :enableNative="false"
  11. :focus="false"
  12. :placeholder="placeholder"
  13. :disabled="inputDisabled"
  14. :confirm-hold="confirmHold"
  15. cursor-spacing="10"
  16. class="solid-bottom"
  17. confirm-type="send"
  18. type="text"
  19. />
  20. <slot name="action">
  21. <button @click="sendClick" :disabled="buttonDisabled" class="cu-btn bg-green shadow">发送</button>
  22. </slot>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: 'l-chat-input',
  28. props: {
  29. value: {},
  30. placeholder: {},
  31. inputDisabled: {},
  32. buttonDisabled: {},
  33. confirmHold: {}
  34. },
  35. data() {
  36. return { inputBottom: 0 }
  37. },
  38. methods: {
  39. input(e) {
  40. this.$emit('input', e.detail.value)
  41. this.$emit('change', e.detail.value)
  42. },
  43. inputFocus(e) {
  44. this.inputBottom = e.detail.height
  45. this.$emit('focus')
  46. },
  47. inputBlur(e) {
  48. this.inputBottom = 0
  49. this.$emit('blur')
  50. },
  51. sendClick(e) {
  52. this.$emit('sendMsg', this.value)
  53. }
  54. }
  55. }
  56. </script>