love-nav-vue/src/main.js

55 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-12-20 18:30:11 +08:00
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from "axios";
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.prototype.axios = axios;
2023-12-23 18:01:51 +08:00
// 请求拦截器, 每次请求都会在请求头中携带token
2023-12-26 00:52:25 +08:00
// axios.interceptors.request.use((config) => {
// if(localStorage.getItem('Authorization')) {
// config.headers.Authorization = localStorage.getItem('Authorization')
// }
// return config;
// }, (error) => {
// return Promise.reject(error);
// })
//
// //http reponse响应拦截器
// axios.interceptors.response.use(
// response =>{
// return response;
// },
// error=>{
// if(error.response){
// switch(error.response.status){
// case 401:
// localStorage.removeItem('Authorization');
// router.replace({
// path: '/home',
// query: {redirect: router.currentRoute.fullPath}//登录成功后跳入浏览的当前页面
// }).then( r =>{
//
// })
// }
// }
// })
2023-12-23 18:01:51 +08:00
2023-12-20 18:30:11 +08:00
// home-style
import './assets/css/home-style.css'
const $ = require('jquery');
window.$ = $;
import * as echarts from 'echarts';//引入echarts
2023-12-24 18:17:00 +08:00
import '@/assets/js/china';
2023-12-20 18:30:11 +08:00
Vue.prototype.$echarts = echarts //引入组件
Vue.config.productionTip = false
Vue.use(ElementUI);
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')