render: function(h,params) {
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: function() {
console.log(this);
this.show(params.index)
}
}
}, '编辑'),
]);
}
methods: {
show: function(index) {
alert(index);
}
}
1:click 用箭头函数.
2:在return上 render下 let self = this ;这样接收一下this,就可以用了