81 lines
1.5 KiB
JavaScript
81 lines
1.5 KiB
JavaScript
import Vue from 'vue'
|
|
import VueRouter from 'vue-router'
|
|
import index from '../views/Index.vue'
|
|
import home from "@/components/home/HomePage.vue";
|
|
import hotNews from "@/components/hotNews/HotNews.vue";
|
|
import navDetail from "@/components/detail/NavDetail.vue";
|
|
import notFound from "@/components/notFound/NotFound.vue";
|
|
import settings from "@/views/Settings.vue";
|
|
import settingsHome from "@/components/setting/SettingPage.vue";
|
|
const originalPush = VueRouter.prototype.push
|
|
VueRouter.prototype.push = function push(location) {
|
|
return originalPush.call(this, location).catch(err => err)
|
|
}
|
|
Vue.use(VueRouter)
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
redirect: '/index'
|
|
},
|
|
{
|
|
path: '/index',
|
|
redirect: '/home',
|
|
name: 'index',
|
|
component: index,
|
|
children: [
|
|
{
|
|
path: '/home',
|
|
name: 'home',
|
|
component: home
|
|
},
|
|
{
|
|
path: '/hotNews',
|
|
name: 'hotNews',
|
|
component: hotNews
|
|
},{
|
|
path: '/navDetail',
|
|
name: 'navDetail',
|
|
component: navDetail
|
|
}
|
|
],
|
|
},
|
|
{
|
|
path: '/settings',
|
|
redirect: '/admin',
|
|
name: 'settings',
|
|
component: settings,
|
|
children: [
|
|
{
|
|
path: '/admin',
|
|
name: 'admin',
|
|
component: settingsHome
|
|
},
|
|
],
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
path: '/404',
|
|
name: 'NoPage404',
|
|
component: notFound,
|
|
hidden: true
|
|
},
|
|
{
|
|
path: '/:pathMatch(.*)',
|
|
redirect: '/404',
|
|
hidden: true
|
|
}
|
|
|
|
|
|
]
|
|
|
|
const router = new VueRouter({
|
|
mode: 'history',
|
|
routes
|
|
})
|
|
|
|
export default router
|