vue配合iview,render使用

//循环数据添加div(点击事件)
render: (h, params) => {//h,表示当前的元素,params表示获取的接口的数据,params.row获取数据中的行的数据,params.row.isMessageCompletion获取数据中的行数据中的isMessageCompletion这个表格的数据
return h('div', {//此时h表示div
style: {
color: 'red',
cursor: 'pointer',
},
attrs: {
class: params.row.isMessageCompletion === false ? 'orz':'',//params.row.isMessageCompletion获取数据中的行数据中的isMessageCompletion这个表格的数据
},
on: {
'click': (event) => {}
}
}, this.tableData[params.index].sampleDressCode)//params.index当前数据的下标
}
 
渲染多个
render:(h,params)=>{
  if(parasm.row.state === 1){
    return h('div',[
          h('a', {
                                        attrs: {
                                            class: 'aClass'
                                        },
                                        on: {
                                            click: () => {
                                                this.jumpDetail(params.row.sampleDevReimId)
                                            }
                                        }
                                    }, '详情'),
                                    h('a', {
                                        attrs: {
                                            class: 'aClass'
                                        },
                                        on: {
                                            click: () => {
                                                this.jumpEdit(params.row.sampleDevReimId)
                                            }
                                        }
                                    }, '编辑'),
  ])
  }
}
posted @ 2019-04-02 19:05  苏小白啊  阅读(857)  评论(0编辑  收藏  举报