CourseCreateStep1.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div class="course-create-wrapper">
  3. <div class="course-create-headerText">
  4. Please choose title of your Course.
  5. </div>
  6. <h2 class="course-create-subtitle">
  7. No worries, you can change title later.
  8. </h2>
  9. <form @input="emitFormData" class="course-create-form">
  10. <div class="course-create-form-group">
  11. <div class="field course-create-form-field control has-icons-right">
  12. <TextInputWithCount
  13. v-model="form.title"
  14. :v="$v.form.title"
  15. :maxLength="50"
  16. />
  17. <div v-if="$v.form.title.$error" class="form-error">
  18. <span v-if="!$v.form.title.required" class="help is-danger">Title is required!</span>
  19. </div>
  20. </div>
  21. </div>
  22. </form>
  23. </div>
  24. </template>
  25. <script>
  26. import { required } from 'vuelidate/lib/validators'
  27. import TextInputWithCount from '~/components/form/TextInputWithCount'
  28. export default {
  29. components: {
  30. TextInputWithCount
  31. },
  32. data() {
  33. return {
  34. form : {
  35. title : ''
  36. }
  37. }
  38. },
  39. validations: {
  40. form: {
  41. title: {
  42. required
  43. }
  44. }
  45. },
  46. computed: {
  47. isValid() {
  48. return !this.$v.$invalid
  49. }
  50. },
  51. methods: {
  52. emitFormData() {
  53. this.$emit('stepUpdated', {data: this.form, isValid: this.isValid})
  54. }
  55. }
  56. }
  57. </script>