iview table行render渲染不同的组件

table不同的行,相同的列渲染不同的组件,如图1:第一行渲染selece,第二行渲染input

render:(h,params)=>{
if(params.index === 0){ //以params.index为条件渲染
return h('div',[
h('Input',{
props:{

},
style:{},
on:{
'on-change':(e)=>{
console.log(e.target.value)
}
}
})
])
};
if(params.index === 1){
return h('div',[
h('Select',{
props:{

},
style:{},
on:{
'on-change':(e)=>{
console.log(e.target.value)
}
}
})
])
};
if(params.index === 2){
return h('div',[
h('InputNumber',{
props:{
min:0
},
style:{
width:'100%'
},
on:{
'on-change':(e)=>{
console.log(e.target.value)
}
}
})
])
};
}
 

猜你喜欢

转载自www.cnblogs.com/web-zqk/p/9593672.html