update switchBtn
This commit is contained in:
@@ -10,9 +10,12 @@ export default {
|
||||
},
|
||||
},
|
||||
data() {
|
||||
const elSwitchModel = this.injectData.enabled ? true : false
|
||||
const propName = this.injectData.head.prop
|
||||
let elSwitchModel = this.injectData[propName] ? true : false
|
||||
|
||||
return {
|
||||
elSwitchModel
|
||||
elSwitchModel,
|
||||
propName
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -32,11 +35,11 @@ export default {
|
||||
// 发射事件
|
||||
emit(booleanValue) {
|
||||
const { id, code } = this.injectData
|
||||
this.$emit('emit-data', { type: 'status', data: { id, code, enabled: booleanValue ? '1' : '0' } })
|
||||
this.$emit('emit-data', { type: 'status', data: { id, code, [this.propName]: booleanValue ? '1' : '0' } })
|
||||
},
|
||||
},
|
||||
render: function (h) {
|
||||
var self = this
|
||||
var self = this
|
||||
return h(
|
||||
"el-switch",
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user