index.js 903 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { VantComponent } from '../common/component';
  2. VantComponent({
  3. field: true,
  4. props: {
  5. value: null,
  6. icon: String,
  7. title: String,
  8. label: String,
  9. border: Boolean,
  10. checked: Boolean,
  11. loading: Boolean,
  12. disabled: Boolean,
  13. activeColor: String,
  14. inactiveColor: String,
  15. useLabelSlot: Boolean,
  16. size: {
  17. type: String,
  18. value: '24px'
  19. },
  20. activeValue: {
  21. type: null,
  22. value: true
  23. },
  24. inactiveValue: {
  25. type: null,
  26. value: false
  27. }
  28. },
  29. watch: {
  30. checked(value) {
  31. this.set({ value });
  32. }
  33. },
  34. created() {
  35. this.set({ value: this.data.checked });
  36. },
  37. methods: {
  38. onChange(event) {
  39. this.$emit('change', event.detail);
  40. }
  41. }
  42. });