改为使用vue-cli打包,修改所有的请求方式,优化页面间的交互,增加数据源分组

This commit is contained in:
暮光:城中城
2020-05-23 12:21:23 +08:00
parent adadffa0cd
commit 88686f84f4
63 changed files with 8421 additions and 8773 deletions

View File

@@ -3,11 +3,6 @@ import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue'
import global from './common/config/global'
import apimix from './common/config/apimix'
import common from './common/lib/common/common'
import toast from './common/lib/common/toast'
import VueRouter from 'vue-router'
import routes from './routes'
import store from './store/index'
@@ -22,44 +17,27 @@ Vue.use(VueRouter);
Vue.use(VueAxios, axios);
Vue.use(vueHljs);
// 全局参数
Vue.prototype.global = global;
// 接口列表
Vue.prototype.apilist1 = apimix.apilist1;
Vue.prototype.apilist2 = apimix.apilist1;
// 公用方法
Vue.prototype.common = common;
Vue.prototype.toast = toast;
Vue.prototype.$store = store;
const router = new VueRouter({routes});
// 路由跳转时判断处理
router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title
}
global.fullscreen = !!to.meta.fullscreen;
/* 判断该路由是否需要登录权限 */
if (to.matched.some(record => record.meta.requireAuth)) {
if (global.user.isLogin) {
next();
} else {
next({path: '/login'});
}
} else {
next();
}
if (to.meta.title) {
document.title = to.meta.title;
}
store.commit('global/setFullscreen', !!to.meta.fullscreen);
next();
});
new Vue({
let vue = new Vue({
el: '#app',
router,
render(h) {
var app = h(App);
global.vue = app.context;
return app;
return h(App);
}
});
export default vue;