I am using Vue Router in my app. When user visits ''
, the HomeComponent
should load and it does! However, when I goto /login
, the LoginComponent
doesn't load and the app redirects me to the 404 page. Please help.
routes.js
import HomeComponent from './components/Home.vue';
import LoginComponent from './components/auth/LoginComponent.vue';
export const routes = [
{path: '', component: HomeComponent},
{path: '/login', component: LoginComponent},
];
app.js
const router = new VueRouter({
mode: 'history',
routes
});
routes/web.php
Route::get('/', function () {
return view('layouts.master');
});
There's this MasterComponent
where these routes load. The HomeComponent
loads but other component don't load. Actually, it happened I when wrote mode: 'history'
in my app.js
! It was working fine earlier until I changed the mode to history.