本文主要是介绍VUE之Router命令行警告:Named Route ‘Home‘ has a default child route. 解决办法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Named Route ‘Home’ has a default child route. When navigating to this named route (:to=“{name: ‘Home’”), the default child route will not be rendered. Remove the name from this route and use the name of the default child route for named links instead.
报错代码:
{path:'/page/home/Home',name:'Home',component:Home,children:[{path: '/',name: 'HomeCarousel',component: HomeCarousel,},]}
总结警告原因:当某个路由有子级路由时,父级路由需要一个默认的路由,所以父级路由不能定义name属性,解决办法是去掉name:'Home’就可以了
正确代码
{path:'/page/home/Home',component:Home,children:[{path: '/',name: 'HomeCarousel',component: HomeCarousel,},]}
这篇关于VUE之Router命令行警告:Named Route ‘Home‘ has a default child route. 解决办法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!