import { use } from '../utils'; import Loading from '../loading'; import SwitchMixin from '../mixins/switch'; const [sfc, bem] = use('switch'); export default sfc({ mixins: [SwitchMixin], methods: { onClick() { if (!this.disabled && !this.loading) { const checked = this.value === this.activeValue; const value = checked ? this.inactiveValue : this.activeValue; this.$emit('input', value); this.$emit('change', value); } } }, render(h) { const { value } = this; const style = { fontSize: this.size, backgroundColor: value ? this.activeColor : this.inactiveColor }; return (
{this.loading && }
); } });