难受就摸头盖骨

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)
}
}
})
])
};
}

posted @ 2018-09-05 18:07  longpanda_怪怪哉  阅读(1661)  评论(0编辑  收藏  举报
下定决心了,要把写不出代码就摸后脑勺的习惯给改了! 如果可以~单身待解救~~