main.js
Vue.config.productionTip = false
Array.prototype.remove || (Array.prototype.remove = function remove(val, isDelete) {
let index = this.indexOf(val)
if (index > -1) {
let isBack = this.splice(index, 1)
return isDelete ? isBack : this
}
return isDelete ? null : this
})
App.mpType = 'app'
const app = new Vue({
// i18n,
store,
...App
})
app.$mount()
使用
data() {
return {
list: [
'1111',
'2222',
'3333'
]
};
},
methods:{
delItem(i) {
console.log(this.list.remove);
this.list.remove(i);
}
}
4 个回复
一顾倾人诚
我H5 可以 真机调试就不行了
1***@163.com - 睿
您解决这个问题了吗
jiangwen1994
其他页面通过 this 进行获取不到挂载在原型链上的全局方法,要通过 getApp().xxx 获取挂载在全局的方法
f***@tom.com - Decode小白
我也遇到了,请问有解决方案吗