使用render自定义渲染时
- 如果是要触发js原生的事件,如 click 事件,直接写即可
render: (h, params) => {
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
this.show(params.index)
}
}
}, 'View')
])
复制代码
- 如果是 iview 组件事件,如 on-click 事件,则需要加上引号
render: (h, params) => {
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
'on-click': () => {
this.show(params.index)
}
}
}, 'View')
])
复制代码