需求:想要拦截this.$router里面的方法进行拦截、但是找不到正确的this
const main = {
install(Vue) {
// 重写replace 方法
Vue.prototype.$_router = {
push(){
// this.$router.push(ars)
console.log(this)
}
}
},
}
Vue.use(main)
需求:想要拦截this.$router里面的方法进行拦截、但是找不到正确的this
const main = {
install(Vue) {
// 重写replace 方法
Vue.prototype.$_router = {
push(){
// this.$router.push(ars)
console.log(this)
}
}
},
}
Vue.use(main)
10 回答11.1k 阅读
6 回答3k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.6k 阅读✓ 已解决
3 回答1.8k 阅读✓ 已解决
2 回答4.7k 阅读✓ 已解决
应该是修改route的原型
route.prototype.push=()=>{}