1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<template>
<el-switch v-model="curValue" :disabled ="disabled"></el-switch>
</template>
<script lang="ts">
import { Vue, Component, Prop, Model } from 'vue-property-decorator';
@Component({})
export default class AppSwitch extends Vue {
/**
* checked选中状态
*
* @type {boolean}
* @memberof Appswitch
*/
@Prop() public value?: any;
get curValue(){
return this.value == 1 ? true:false;
}
set curValue(value:any){
let emitValue = value == true ? 1:0;
this.$emit('change',emitValue);
}
/**
* 禁用
*
* @type {boolean}
* @memberof Appswitch
*/
@Prop() public disabled?: boolean;
}
</script>
<style lang='less'>
@import './app-switch.less';
</style>