You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.7 KiB

import Vue from 'vue';
import VueRouter from 'vue-router';
import store from '../store';
import HomeView from '../views/HomeView.vue';
// import Franchise from '../views/Franchise.vue'
5 months ago
Vue.use(VueRouter)
const whiteSlideList = ['/','/franchise'];//侧边导航白名单
const whiteFooterList = ['/','/franchise'];//侧边导航白名单
5 months ago
const routes = [
{
path: '/',
name: 'home',
component: HomeView
// component: Franchise
5 months ago
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
},
{
path: '/ui',
name: 'ui',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/elementGroups.vue')
},
{
path: '/franchise',
name: '加盟',
component: () => import(/* webpackChunkName: "about" */ '../views/Franchise.vue')
5 months ago
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
router.beforeEach((to, from, next) => {
console.log(to.path,'to.path-----');
if (whiteSlideList.includes(to.path)) {
store.commit('SET_SIDEBAR', true); // 登录页面不显示侧边栏
} else {
store.commit('SET_SIDEBAR', false); // 其他页面显示侧边栏
}
if (whiteFooterList.includes(to.path)) {
store.commit('SET_FOOTER', true); // 登录页面不显示侧边栏
} else {
store.commit('SET_FOOTER', false); // 其他页面显示侧边栏
}
next();
});
5 months ago
export default router