You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/vc-switch/demo/simple.vue

36 lines
712 B

<script>
import VcSwitch from '../index';
import '../assets/index.less';
export default {
data() {
return {
disabled: false,
};
},
methods: {
toggle() {
this.disabled = !this.disabled;
},
onChange(value) {
console.log(`switch checked: ${value}`); // eslint-disable-line
},
},
render() {
return (
<div style="margin: 20px">
<VcSwitch
onChange={this.onChange}
disabled={this.disabled}
checkedChildren={'开'}
unCheckedChildren={'关'}
/>
<div style="margin-top: 20px">
<button onClick={this.toggle}>toggle disabled</button>
</div>
</div>
);
},
};
</script>