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.

44 lines
808 B

2 years ago
  1. <template>
  2. <v-form v-model="valid">
  3. <v-textarea
  4. v-model="message"
  5. auto-grow
  6. hide-details
  7. outlined
  8. rows="1"
  9. name="CommentInput"
  10. :label="$t('comments.message')"
  11. :rules="commentRules"
  12. />
  13. <v-btn
  14. class="white--text text-capitalize mt-3"
  15. color="primary"
  16. depressed
  17. :disabled="!valid"
  18. @click="addComment"
  19. >
  20. {{ $t('comments.send') }}
  21. </v-btn>
  22. </v-form>
  23. </template>
  24. <script lang="ts">
  25. import Vue from 'vue'
  26. export default Vue.extend({
  27. data() {
  28. return {
  29. commentRules: [(v: string) => !!v.trim() || 'Comment is required'],
  30. message: '',
  31. valid: false
  32. }
  33. },
  34. methods: {
  35. addComment() {
  36. this.$emit('add-comment', this.message)
  37. this.message = ''
  38. }
  39. }
  40. })
  41. </script>