Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

73 rader
1.4 KiB

  1. <template>
  2. <view :style="rootStyle" :class="className" 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. if (e && e.detail && e.detail.height) {
  45. this.inputBottom = e.detail.height
  46. }
  47. this.$emit('focus')
  48. },
  49. inputBlur(e) {
  50. this.inputBottom = 0
  51. this.$emit('blur')
  52. },
  53. sendClick(e) {
  54. this.$emit('sendMsg', this.value)
  55. }
  56. },
  57. computed: {
  58. rootStyle() {
  59. return this.getStyle({ bottom: this.inputBottom + 'px' })
  60. // return this.getStyle({ bottom: '0px' })
  61. }
  62. }
  63. }
  64. </script>