项目场景:
<font color=#999AAA >简述项目相关背景:
bug场景:
在学习vue-router,路由传参的部分的时候,在APP.vue页面中的
</font>
<router-link :to="{name:'Hi1',parmas:{username:'canyang'}}">
在Hi.vue页面中接收参数
<h2>
{{$route.parmas.username}}
</h2>
<hr style=" border:solid; width:100px; height:1px;" color=#000000 size=1">
问题描述:
<font color=#999AAA >提示:这里描述项目中遇到的问题:
Error in render:
<font color=red size=5>
报错:
"[Vue warn]: Error in render: "TypeError: Cannot read property 'username' of undefined"</font>
<font color=red size=5>
"TypeError: Cannot read property 'username' of undefined"
App.vue错误代码标识
</font>
<hr style=" border:solid; width:100px; height:1px;" color=#000000 size=1">
Hi.vue文件中错误代码标识
<hr style=" border:solid; width:100px; height:1px;" color=#000000 size=1">
原因分析:
<font color=#999AAA >问题的分析:
在报这个错之后,进行了代码查询,router/index.js中name是否一致
然后检查各个字段,[$route]等参数是否写错
</font>
<hr style=" border:solid; width:100px; height:1px;" color=#000000 size=1">
解决方案:
<font color=#999AAA >具体解决方案:
对比到params的时候发现单词写错了,所以 改掉就可以了</font>
网友评论