ChatInput.vue 983 B

1234567891011121314151617181920212223242526272829303132333435
  1. <script setup lang="ts">
  2. import { ref } from 'vue';
  3. const { value: inputValue } = defineProps(['value']);
  4. const emit = defineEmits(['submit', 'update:value']);
  5. </script>
  6. <template>
  7. <McInput
  8. :value="inputValue"
  9. :maxLength="2000"
  10. @change="(newValue: string) => emit('update:value', newValue)"
  11. @submit="emit('submit', inputValue)"
  12. >
  13. <template #extra>
  14. <div class="input-foot-wrapper">
  15. <div class="input-foot-left">
  16. <span class="input-foot-dividing-line"></span>
  17. <span class="input-foot-maxlength">{{ inputValue.length }}/2000</span>
  18. </div>
  19. <div class="input-foot-right">
  20. <d-button
  21. icon="op-clearup"
  22. shape="round"
  23. :disabled="!inputValue"
  24. @click="emit('update:value', '')"
  25. >
  26. 清空输入
  27. </d-button>
  28. </div>
  29. </div>
  30. </template>
  31. </McInput>
  32. </template>