I am new to Laravel and Vue JS. I am trying to integrate vue in a laravel project and my vue-router is not working and I don't understand why. I am trying to go to the path /login but it just renders the Example component. How can I fix this?
app.js
require('./bootstrap');
window.Vue = require('vue');
import router from './router';
import Example from "./components/ExampleComponent";
const app = new Vue({
el: '#app',
render: h => h(Example),
router
});
router.js
import Vue from 'vue';
import VueRouter from 'vue-router';
import Example from './components/ExampleComponent';
import Login from './components/LoginComponent';
Vue.use(VueRouter)
const routes = [
{
path: "/",
component: Example,
name: "example"
},
{
path: "/login",
component: Login,
name: "login"
}
];
export default new VueRouter({
mode: 'history',
routes
})
web.php
– Kamlesh Paul