import snippets from './snippets'; export default { snippets, componentName: 'Switch', title: 'switch', category: 'Form', props: [ { name: 'defaultChecked', title: { label: 'default checked', tip: 'is it selected by default?' }, propType: 'bool', defaultValue: false, setter: 'BoolSetter' }, { name: 'checked', title: { label: 'checked', tip: 'is it currently selected' }, propType: 'bool', defaultValue: false, setter: 'BoolSetter', supportVariable: true, }, { name: 'autoFocus', title: { label: 'auto focus', tip: 'Component automatically gets focus' }, propType: 'bool', defaultValue: false, setter: 'BoolSetter' }, { name: 'checkedChildren', title: { label: 'checked children', tip: 'content when selected' }, propType: 'string', setter: 'StringSetter' }, { name: 'unCheckedChildren', title: { label: 'un checked children', tip: 'Content when unselected' }, propType: 'string', setter: 'StringSetter' }, { name: 'disabled', title: { label: 'disabled', tip: 'disabled' }, propType: 'bool', defaultValue: false, setter: 'BoolSetter' }, { name: 'loading', title: { label: 'loading', tip: 'loading' }, propType: 'bool', defaultValue: false, setter: 'BoolSetter' }, { name: 'size', title: { label: 'size', tip: 'switch size' }, propType: { type: 'oneOf', value: ['default', 'small'] }, setter: { componentName: 'RadioGroupSetter', props: { options: [ { title: 'default', value: 'default', }, { title: 'small', value: 'small', }, ], }, }, defaultValue: 'default', }, { name: 'onChange', title: { label: 'function on change', tip: 'function on change' }, propType: 'func', }, { name: 'onClick', title: { label: 'on when clicked', tip: 'callback function when clicked' }, propType: 'func', }, // { // name: 'className', // title: { label: 'class name', tip: 'class name' }, // propType: 'string', // }, ], configure: { supports: { style: true, events: [ { name: 'onChange', template: "onChange(checked,event,${extParams}){\n// 变化时回调函数\nconsole.log('onChange',checked,event);}", }, { name: 'onClick', template: "onClick(checked,event,${extParams}){\n// 点击时回调函数\nconsole.log('onClick',checked,event);}", }, ], }, }, };