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.

46 lines
824 B

  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: [
  30. (v: string) => !!v.trim() || 'Comment is required'
  31. ],
  32. message: '',
  33. valid: false
  34. }
  35. },
  36. methods: {
  37. addComment() {
  38. this.$emit('add-comment', this.message)
  39. this.message = ''
  40. }
  41. }
  42. })
  43. </script>