vue3路由转发报错Failed to resolve component: router-link

发布时间 2023-11-04 09:31:28作者: 无名就是有名

 

//在学习vue3路由转发的时候,总是报路由的一些方法无法识别,undefined
报错:
  // App.vue:9 [Vue warn]: Failed to resolve component: router-link
  // vue路由跳转报错Cannot read properties of undefined (reading 'push')
原因:
  出在你挂载的位置   这个路由的use方法必须写在整体挂载方法mount之前 我的不在于顺序,而是

 



为了避免出错,还是这样写,简洁美观

// createApp(App)
//     .use(router)
//     .mount('#app')