init
This commit is contained in:
80
src/router/index.js
Normal file
80
src/router/index.js
Normal file
@@ -0,0 +1,80 @@
|
||||
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
|
Reference in New Issue
Block a user