columnsKey: [
{
title: '编码',
key: 'code',
render: (h, params) => {
let _this = this; //防止调用 为空
return h('Input', {
props: {
type: 'text',
value: params.row.code
},
on: {
input: function (event) {
params.row.code = event
_this.dataEntity[params.index][params.column.key] = event;
}
}
})
}
},
{
title: '必填',
key: 'required',
render: (h, params) => {
let _this = this; //防止调用 为空
return h('i-switch', {
props: {
type: 'text',
trueValue :'1', //是
falseValue :'0',//否
value: params.row.required === 1 //控制开关的打开或关闭状态,官网文档属性是value
},
scopedSlots:{
open:()=>h('span','是'),
close:()=>h('span','否')
},
on: {
'on-change': (value) => {//触发事件是on-change,用双引号括起来,
//打开是true,已经处理1
if (value === 1) {
_this.dataEntity[params.index][params.column.key] = 1
} else {
_this.dataEntity[params.index][params.column.key] = 0
}
}
}
})
}
}
]