index.js 827B

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