E
E
Emil Rakhmatullin2020-08-28 10:22:58
Laravel
Emil Rakhmatullin, 2020-08-28 10:22:58

How to make a SPA application on Laravel and Vue Router?

In all the examples that I googled and the documentation shows something like:

const router = new VueRouter({
  routes: [
    {
      path: '/user/:userId',
      name: 'user',
      component: User
    }
  ]
})

BUT! I want to register routes in web.php (they are all there). So I need to duplicate the routes from web.php to VueRouter ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton, 2020-08-28
@karminski

SPA-SINGLE Page Application. Those. from the point of view of Laravel - you have ONE page on which you connect Vue.JS, and which itself already resolves the application's routing. Those. the correct option is in Laravel one route (like only /), and the rest in Vue.

V
Vladislav, 2020-09-04
@vos_50

Usually in web.php there is only one route like Rote::any

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question