B
B
BonBon Slick2020-05-12 21:52:51
typescript
BonBon Slick, 2020-05-12 21:52:51

Vue + TypeScript $route is undefined?

I tried different things, I'm missing something, some kind of config or something else

import VueRouter from 'vue-router';

import Home from '@/components/public/pages/home/index.vue';

export default new VueRouter({
    mode: 'history',
    routes: [
        {path: '/', name: 'home', component: Home},

    ],
    linkActiveClass: 'active',
  
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bubaley, 2020-05-13
@BonBonSlick

Not sure, but most likely you didn't add router to vue itself.
https://www.github.com/bubaley/django-vue-start/tr...
Look in this project, there is almost an empty vue cli project.
Notice how it is added in the main.js file.
The router itself is in the router folder.
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL, (remove this line)
routes
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question