Skip to content

Commit

Permalink
2.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tower1229 committed Mar 29, 2022
1 parent db5f6c1 commit a40c730
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
8 changes: 7 additions & 1 deletion mock/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Mock数据
* 同目录*.js文件将视为定义接口文件,将尝试注册为Mock接口
* 同目录*.json文件将视为YAPI导出的json数据,将自动解析并注册为Mock接口
* */

import Vue from 'vue'
Vue.DebugRequest = true;
console.log(`[Mock] Start. Please make sure that main.js => AccessControl is closed, otherwise it will not work properly`)
Expand Down Expand Up @@ -121,7 +127,7 @@ export const runJsMock = function () {
let jsmocks = []

jsctx.keys().forEach((key) => {
if (key !== './index.js') {
if (key !== './index.js' && Array.isArray(jsctx(key).default)) {
jsmocks.push(jsctx(key).default)
}
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "template-element-ui",
"version": "2.8.3",
"version": "2.8.4",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
Expand Down
6 changes: 3 additions & 3 deletions src/core/assets/global.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import url('./global.reset.css');
@import url('./global.component.css');
@import url('./global.element.custom.css');
@import url('./global.ui.custom.css');


/* page layout */
Expand Down Expand Up @@ -28,7 +28,7 @@ body {
}

.wrap {
width : 900px;
width : 900px;
margin-left : auto;
margin-right: auto;
}
}
File renamed without changes.
17 changes: 8 additions & 9 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ import Vue from 'vue';
// import mocker from '../mock';
// mocker()

// UI库
import ElementUI from '@/element-ui.install';
Vue.use(ElementUI);
// 全局样式
import '@/core/assets/global.css';
// 加载根组件
import App from './App.vue';

// 预安装
import preInstall from '@/pre-install';
Vue.use(preInstall);

// 核心插件
// 安装核心插件
import plugins from '@/core/plugins';
Vue.use(plugins);

// 路由
// 创建路由实例
import { routeGenerator } from '@/core';
const routeInstance = routeGenerator({
beforeEach: ((to, from, next) => {
Expand All @@ -30,8 +31,6 @@ const routeInstance = routeGenerator({
})

// 应用启动
import App from './App.vue';

new Vue({
router: routeInstance,
render: h => h(App)
Expand Down
6 changes: 6 additions & 0 deletions src/element-ui.install.js → src/pre-install.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// 组件库按需引入
import {
Loading,
Pagination,
Expand Down Expand Up @@ -177,8 +178,13 @@ const components = [

import 'element-ui/lib/theme-chalk/index.css';

// 加载全局样式
import '@/core/assets/global.css';

// 预安装插件
export default {
install: function (Vue, opts = {}) {
// 安装ElementUI
components.forEach(component => {
Vue.use(component);
});
Expand Down
4 changes: 2 additions & 2 deletions src/request.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// 各环境baseURL配置
// 各环境BaseURL配置
const ENVIRONMENT = {
mock: 'http://yapi.sogdata.com/mock/125', // 内网YAPI项目
dev: 'http://retire.kaifa/japi',
Expand All @@ -14,7 +14,7 @@ const HASH = {
"master.com": ENVIRONMENT.master
}

// axios 请求实例配置
// Axios 请求实例配置
export default {
baseURL: HASH[window.location.host] || ENVIRONMENT.mock,
timeout: 10000,
Expand Down

0 comments on commit a40c730

Please sign in to comment.