问题描述
点击delete或者view页面没反应,后台报错
vue.min.js:6 TypeError: this.remove is not a function
this.show is not a function
问题出现的环境背景及自己尝试过哪些方法
没办法~
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
var app=new Vue({
el:'#app',
data: {
columns7: [
{
title: 'Name',
key: 'name',
render: (h, params) => {
return h('div', [
h('Icon', {
props: {
type: 'person'
}
}),
h('strong', params.row.name)
]);
}
},
{
title: 'Age',
key: 'age'
},
{
title: 'Address',
key: 'address'
},
{
title: 'Action',
key: 'action',
width: 150,
align: 'center',
render: (h, params) => {
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
this.show(params.index)
}
}
}, 'View'),
h('Button', {
props: {
type: 'error',
size: 'small'
},
on: {
click: () => {
this.remove(params.index)
}
}
}, 'Delete')
]);
}
}
],
data6: [
{
name: 'John Brown',
age: 18,
address: 'New York No. 1 Lake Park'
},
{
name: 'Jim Green',
age: 24,
address: 'London No. 1 Lake Park'
},
{
name: 'Joe Black',
age: 30,
address: 'Sydney No. 1 Lake Park'
},
{
name: 'Jon Snow',
age: 26,
address: 'Ottawa No. 2 Lake Park'
}
]
},
methods:{
show (index) {
this.$Modal.info({
title: 'User Info',
content: `Name:${this.data6[index].name}
Age:${this.data6[index].age}
Address:${this.data6[index].address}`
})
},
remove (index) {
this.data6.splice(index, 1);
}
}
})
你期待的结果是什么?实际看到的错误信息又是什么?
到底是哪里有问题啊,求帮助!!!