import Vue from 'vue' import App from './App.vue' import router from './router' import './plugins/element.js' // 导入时间插件 import moment from 'moment' // 导入全局样式表 import './assets/css/global.css' // 引入字体图标 import './assets/fonts/iconfont.css' import TreeTable from 'vue-table-with-tree-grid' // 引入富文本插件 import VueQuillEditor from 'vue-quill-editor' // 导入富文本编辑器对应的样式 import 'quill/dist/quill.core.css' // import styles import 'quill/dist/quill.snow.css' // for snow theme import 'quill/dist/quill.bubble.css' // for bubble theme // 导入网页进度条 import NProgress from 'nprogress' import 'nprogress/nprogress.css' // import '../node_modules/xxoo/L2Dwidget.0.min' // import '../node_modules/xxoo/L2Dwidget.min' // 引入axios import axios from 'axios' // 基本路径 axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/' // 挂载 Vue.prototype.$http = axios axios.interceptors.request.use((config) => { NProgress.start() console.log(config) config.headers.Authorization = window.sessionStorage.getItem('token') return config // 最后必须returnconfig不然报错 }) axios.interceptors.response.use((config) => { NProgress.done() return config // 最后必须returnconfig不然报错 }) // 中文简体 moment.locale('zh-cn') Vue.filter('dateformat', (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') => { return moment(dataStr).format(pattern) }) Vue.config.productionTip = false Vue.component('tree-table', TreeTable) // 注册为全局组件 Vue.use(VueQuillEditor) new Vue({ router, render: h => h(App) }).$mount('#app')
后台src-main.js详情
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
// 导入时间插件
import moment from 'moment'
// 导入全局样式表
import './assets/css/global.css'
// 引入字体图标
import './assets/fonts/iconfont.css'
import TreeTable from 'vue-table-with-tree-grid'
// 引入富文本插件
import VueQuillEditor from 'vue-quill-editor'
// 导入富文本编辑器对应的样式
import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme
// 导入网页进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
// import '../node_modules/xxoo/L2Dwidget.0.min'
// import '../node_modules/xxoo/L2Dwidget.min'
// 引入axios
import axios from 'axios'
// 基本路径
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
// 挂载
Vue.prototype.$http = axios
axios.interceptors.request.use((config) => {
NProgress.start()
console.log(config)
config.headers.Authorization = window.sessionStorage.getItem('token')
return config
// 最后必须returnconfig不然报错
})
axios.interceptors.response.use((config) => {
NProgress.done()
return config
// 最后必须returnconfig不然报错
})
// 中文简体
moment.locale('zh-cn')
Vue.filter('dateformat', (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') => {
return moment(dataStr).format(pattern)
})
Vue.config.productionTip = false
Vue.component('tree-table', TreeTable)
// 注册为全局组件
Vue.use(VueQuillEditor)
new Vue({
router,
render: h => h(App)
}).$mount('#app')