
获得徽章 0
- 无语了,mac上创建vite项目就是给我报错,查到说是esbuild的bug,按那个上面执行node node_modules/esbuild/install.js也不行啊,求解?赞过41
- vue create 创建项目没反应;
vue --version 一看版本还是2.8.6;
升级,没用
直接where vue 去删掉整个vue文件夹
再npm install -g @vue/cli重新安装下
可以了展开3点赞 - v-on:$listeners v-on:testFn=""
1、如果 listeners 中也有 testFn 绑定方法,则子组件中emit('testFn'),会先后调用当前组件及父组件中的方法,
2、联想到mixins,当前组件中同名方法会覆盖掉混合对象中的该方法,生命周期方法会都执行,先执行混合中的再执行当前对象评论点赞 - Error: Redirected when going from "X" to "X" via a navigation guard.
---------------------解决方案------------------------------
原因:
V3.1.0版本里面新增功能:push和replace方法会返回一个promise, 你可能在控制台看到未捕获的异常。
解决:
在你的routers.js中,引入Router后,对Router原型链上的push、replace方法进行重写,这样就不用每次调用方法都要加上catch。
import Router from 'vue-router'
const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch(err => err)
}
或者降级vue
参考链接:如下展开评论点赞