FormSwitch.vue 952 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <div class="field">
  3. <label :for="fieldName" class="label" v-html="label"></label>
  4. <input :id="fieldName" type="checkbox" :name="fieldName" class="switch is-thin is-info" v-model="form[fieldName]">
  5. <label :for="fieldName" class="label"></label>
  6. <p class="help" v-html="help" v-if="help"></p>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. name: 'FormSwitch',
  12. data() {
  13. return {
  14. }
  15. },
  16. props: {
  17. label: {
  18. type: String,
  19. default: ''
  20. },
  21. fieldName: {
  22. type: String,
  23. default: '',
  24. required: true
  25. },
  26. form: {
  27. type: Object,
  28. required: true
  29. },
  30. help: {
  31. type: String,
  32. default: ''
  33. },
  34. }
  35. }
  36. </script>