vue
寻绾
这个作者很懒,什么都没留下…
展开
-
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “/“
解决办法:将如下代码加入到路由设置文件index.js中即可const originalPush = VueRouter.prototype.pushVueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) }原创 2022-01-06 10:00:00 · 752 阅读 · 0 评论 -
pubsub.js消息的发布订阅
组件间数据的传递方式props,一层一层传递消息的发布订阅,当嵌套层数比较多,可以用此工具库下载$ npm install pubsub-js --save语法PubSub.publish('订阅名', data) //发布消息PubSub.subscrib('订阅名', (msg,data) => {} ) //订阅消息PubSub.unsubscrib('订阅名ID号') //取消订阅使用// 导入import PubSub from "pubsub-js"原创 2021-12-24 17:57:59 · 261 阅读 · 0 评论