Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: Cannot read property '_normalized' of undefined when using router-link in vue

Tags:

vue.js

I am using the following router link in a Vue component:

 <router-link :to="{ name: 'home'}"></router-link>

The rest of my app is as follows:

Router.js

  new VueRouter({
  mode: "history",
  routes: [
    {
      name: 'home',
      path: '/home',
      component: home,
    }
 ]})

Main.js

new Vue({
  render: (h) => h(App),
  router,
}).$mount("#app");

Getting the below error when using router-link, but router.push() is working fine with routes.

TypeError: Cannot read property '_normalized' of undefined (vue.min.js:6)
like image 722
dharshini priya Avatar asked May 21 '20 15:05

dharshini priya


1 Answers

In your Vue component use

<router-link to="/home"></router-link>
like image 119
josoye24 Avatar answered Nov 14 '22 03:11

josoye24