vue.js - 类型错误:在 vue 中使用路由器链接时无法读取未定义的属性“_normalized”
问题描述
我在 Vue 组件中使用以下路由器链接:
<router-link :to="{ name: 'home'}"></router-link>
我的应用程序的其余部分如下:
路由器.js
new VueRouter({
mode: "history",
routes: [
{
name: 'home',
path: '/home',
component: home,
}
]})
主.js
new Vue({
render: (h) => h(App),
router,
}).$mount("#app");
使用 router-link 时出现以下错误,但 router.push() 与路由正常工作。
TypeError: Cannot read property '_normalized' of undefined (vue.min.js:6)
解决方案
在你的 Vue 组件中使用
<router-link to="/home"></router-link>
推荐阅读
- php - 网页将php文件下载到浏览器而不是运行它
- java - 对包含私有支持方法的公共方法进行单元测试?
- php - 解析avahi-browse结果
- excel - 从输入值 vba 中删除不同工作表上的行
- excel - 仅在特定单元格数据之后动态排序数据
- css - React Bootstrap Tabs - 在 div 的整个宽度上均匀分布
- ios - 如何在 Swift 函数中输入参数?
- python - ValueError:数学域错误。为什么我得到这个错误
- excel - 如何从 RangetoHTML 函数中保存 XLSX 以用作 OL 附件
- c++ - 使用具有依赖关系的 qt-creator 编译 .pro 文件?