123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- /*
- * @Author: zouwenying
- * @Date: 2020-10-21 18:14:35
- * @LastEditTime: 2021-03-25 16:56:49
- * @LastEditors: Please set LastEditors
- * @Description: 主入口js文件
- */
- import Vue from 'vue';
- import App from './App.vue';
- import router from './router';
- import Vuex from 'vuex';
- import ElementUI from 'element-ui';
- import 'element-ui/lib/theme-chalk/index.css'; // 默认主题
- import '@utils/rem.js';
- import http from '@utils/http.js';
- import store from "./store/store.js"
- Vue.config.productionTip = false;
- Vue.use(Vuex);
- Vue.use(ElementUI, {
- size: 'small'
- });
- Vue.prototype.$http = http;
- //使用钩子函数对路由进行权限跳转
- router.beforeEach((to, from, next) => {
- if(!/^(\/|\/login)$/.test(to.path)) {
- // 判断是否登录
- if(localStorage.getItem('SC_token')) {
- next();
- } else {
- next('/');
- }
- } else {
- next();
- }
- });
- new Vue({
- router,
- store,
- render: h => h(App)
- }).$mount('#app');
|