ant-design-vue/components/vc-switch/demo/simple.vue

36 lines
716 B
Vue
Raw Normal View History

2018-02-27 04:14:29 +00:00
<script>
2019-01-12 03:33:27 +00:00
import VcSwitch from '../index';
import '../assets/index.less';
2018-02-27 04:14:29 +00:00
export default {
data () {
return {
disabled: false,
2019-01-12 03:33:27 +00:00
};
2018-02-27 04:14:29 +00:00
},
methods: {
toggle () {
2019-01-12 03:33:27 +00:00
this.disabled = !this.disabled;
2018-02-27 04:14:29 +00:00
},
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>
2019-01-12 03:33:27 +00:00
);
2018-02-27 04:14:29 +00:00
},
2019-01-12 03:33:27 +00:00
};
2018-02-27 04:14:29 +00:00
</script>