index.js 626 B

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