iview中table里嵌套i-switch、input、select等
iview中table内嵌套
input
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
render:(h,params) => {
return h('Input',{
props: {
value:'',
size:'small',
},
on: {
input: (val) => {
t.data[params.index].estimateTime = val
}
},
})
}
select
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
render: (h, params) => { return h('Select',{ props:{ }, on: { 'on-change':(event) => { this.data[params.index].volumeType = event; } }, }, params.row.action.map((item) =>{ return h('Option', { props: { value: item.value, label: item.name } }) }) ) }
i-switch
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
render: (h, params) => { //return h('元素',{元素的性质},'内容') return h('i-switch', { props: { size: "large", value: params.row.status == "true" }, on: { 'on-change': (value) => { params.row.status = value; const th = this; axios.get(th.url + '/departmentType/updateStatus', { params: { dId: params.row.dId, status: value } }).then(function(res) { if (res.data.code === 1028) { th.$Message.success(res.data.message); } else { th.$Message.error(res.data.message); th.changePage(1); } }) } } }, [h('span', { slot: "open", domProps: { innerHTML: '正常' } }), h('span', { slot: "close", domProps: { innerHTML: '冻结' } }), ] ) }
InputNumber
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
render: (h, params) => { return h('div', [ h('InputNumber', { props: { size: "large", value: params.row.dSort }, on: { 'on-change': (value) => { this.DepartmentType.dId =params.row.dId; this.DepartmentType.dSort = value; this.updateSort(); } } }) ]) }