Моя маршрутизация для моего сайта работает нормально, но проблема возникает, когда я нажимаю кнопку обновления.
На базовом маршруте, например, http://localhost:8080/employers
стиль страницы или компонента остается тем же, но когда я обновляю дочерний маршрут, например, http://localhost:8080/employers/google
, весь стиль для этого компонента будет потерян.
Любая помощь по решению этой проблемы будет оценена
import Vue from 'vue'
import Router from 'vue-router'
// import store from './store.js'
Vue.use(Router)
const router = new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [
{
path: '/',
component: () => import('./views/Home.vue'),
children: [
{
path: "",
component: () => import("./views/HomePage.vue"),
},
{
path: '/jobs',
name: 'jobs',
component: () => import('./views/JobListings.vue')
},
{
path: '/job/:id',
name: 'job',
component: () => import('./views/JobDetails.vue')
},
{
path: '/login',
name: 'login',
component: () => import('./views/Login.vue')
},
{
path: '/register',
name: 'register',
component: () => import('./views/Register.vue')
},
{
path: '/forgotpassword',
name: 'forgotpassword',
component: () => import('./views/ForgotPassword.vue')
},
{
path: '/verify',
name: 'verify',
component: () => import('./views/Verify.vue')
},
],
},
{
path: '/employer',
component: () => import('@/views/Employers.vue'),
children: [
{
path: '',
component: () => import('./views/Employers/Profile.vue')
},
{
path: 'profile',
component: () => import('./views/Employers/Profile.vue')
},
{
path: 'post',
component: () => import('./views/Employers/PostJob.vue')
},
{
path: 'listings',
component: () => import('./views/Employers/Listings.vue')
},
{
path: 'settings',
component: () => import('./views/Employers/Listings.vue')
},
{
path: 'editresume',
component: () => import('./views/Employers/Listings.vue')
},
{
path: 'closeaccount',
component: () => import('./views/Employers/Listings.vue')
},
]
},
// jobseekers route
{
path: '/jobseeker',
component: () => import('@/views/Jobseekers/Home.vue'),
children: [
{
path: '',
component: () => import('@/views/Jobseekers/Profile.vue')
},
{
path: 'resume',
component: () => import('@/views/Jobseekers/Resume.vue')
},
{
path: 'profile',
component: () => import('@/views/Jobseekers/Profile.vue')
},
{
path: 'settings',
component: () => import('@/views/Jobseekers/Settings.vue')
},
{
path: 'applications',
component: () => import('@/views/Jobseekers/Applications.vue')
},
{
path: 'close',
component: () => import('@/views/Jobseekers/Close.vue')
},
]
},
{
path: '/jobseeker/:page',
component: () => import('@/views/Jobseekers/Profile.vue'),
},
{
path: '/search/:region/:keyword',
component: () => import('./views/JobListings.vue')
},
// not found route
{
path: '*',
name: '404',
component: () => import('./views/404.vue')
}
]
})
export default router