Skip to content

Commit 29a591d

Browse files
author
白唯
committedOct 31, 2020
fix(thme): 修改 ant-design-vue自定义主题在 build 之后无法覆盖成功的问题
1 parent 023d4ee commit 29a591d

14 files changed

+57
-72
lines changed
 

‎.env.development

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
NODE_ENV=development
2-
// VUE_APP_BASE_URL = //10.10.10.115:8002
3-
VUE_APP_BASE_URL = //apitest.cuidc.net
4-
VUE_APP_BASE_EDITOR_URL = //editorapitest.cuidc.net
5-
VUE_APP_EDITOR_JS = //editortest.cuidc.net
6-
VUE_APP_UPLOADED_URL = //bus.cuidc.net/
7-
VUE_APP_EDITOR_URL_AUTH = a453964db52ff10ad0a3adf4be4dd4e5
1+
NODE_ENV=development

‎.env.preview

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
NODE_ENV=production
2-
VUE_APP_BASE_URL = //apitest.cuidc.net
3-
VUE_APP_BASE_EDITOR_URL = //editorapitest.cuidc.net
4-
VUE_APP_UPLOADED_URL = //bus.cuidc.net/
5-
VUE_APP_EDITOR_JS = //editortest.cuidc.net
6-
VUE_APP_EDITOR_URL_AUTH = 7f35b26c51e980153763ee996542f541
1+
NODE_ENV=production

‎.env.production

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
NODE_ENV=production
2-
VUE_APP_BASE_URL = //api.cuidc.net
3-
VUE_APP_BASE_EDITOR_URL = //editorapi.cuidc.net
4-
VUE_APP_EDITOR_JS = //editor.cuidc.net
5-
VUE_APP_UPLOADED_URL = //bus-acc.cuidc.net/
6-
VUE_APP_EDITOR_URL_AUTH = e3e5e9488f3e2e2857fc045b9c48566b
7-
8-
9-
1+
NODE_ENV=production
2+
3+
4+

‎babel.config.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
module.exports = {
2-
presets: ['@vue/cli-plugin-babel/preset'],
3-
plugins: [['import', { libraryName: 'ant-design-vue', libraryDirectory: 'es', style: true }]]
4-
}
1+
module.exports = {
2+
presets: ['@vue/cli-plugin-babel/preset']
3+
}

‎src/assets/fonts/Helvetica.eot

25.6 KB
Binary file not shown.

‎src/assets/fonts/Helvetica.otf

45.7 KB
Binary file not shown.

‎src/assets/fonts/Helvetica.ttf

18.3 KB
Binary file not shown.

‎src/assets/fonts/Helvetica.woff

14.4 KB
Binary file not shown.

‎src/assets/fonts/Helvetica.woff2

11.2 KB
Binary file not shown.

‎src/layout/AppLayout.vue

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<template>
2-
<div class="app-layout">
3-
<router-view v-if="fullScreenMode" />
4-
<div class="app-content" v-else>
5-
<app-header />
6-
<div id="nav">
7-
<router-link to="/">Home</router-link> | <router-link to="/about">About</router-link> | <router-link to="/contact">Contact</router-link> |
8-
<router-link to="/tests">组件测试</router-link>
9-
</div>
10-
<router-view class="router-view" />
11-
<app-footer />
12-
</div>
13-
</div>
2+
<div class="app-layout">
3+
<router-view v-if="fullScreenMode" />
4+
<div class="app-content" v-else>
5+
<app-header />
6+
<div id="nav">
7+
<router-link to="/">Home</router-link> | <router-link to="/about">About</router-link> | <router-link to="/contact">Contact</router-link> |
8+
<router-link to="/tests">组件测试</router-link>
9+
</div>
10+
<router-view />
11+
<app-footer />
12+
</div>
13+
</div>
1414
</template>
1515

1616
<script>
@@ -20,35 +20,35 @@ import { defineComponent, ref, watch } from 'vue'
2020
import { useRouter } from 'vue-router'
2121
2222
export default defineComponent({
23-
components: {
24-
AppFooter,
25-
AppHeader
26-
},
27-
setup() {
28-
const fullScreenMode = ref(true)
29-
const router = useRouter()
30-
watch(router.currentRoute, () => {
31-
fullScreenMode.value = Boolean(router.currentRoute.value.meta?.fullScreen)
32-
})
23+
components: {
24+
AppFooter,
25+
AppHeader
26+
},
27+
setup() {
28+
const fullScreenMode = ref(true)
29+
const router = useRouter()
30+
watch(router.currentRoute, () => {
31+
fullScreenMode.value = Boolean(router.currentRoute.value.meta?.fullScreen)
32+
})
3333
34-
return {
35-
fullScreenMode
36-
}
37-
}
34+
return {
35+
fullScreenMode
36+
}
37+
}
3838
})
3939
</script>
4040
4141
<style lang="less" scoped>
4242
.app-layout {
43-
height: 100%;
43+
height: 100%;
4444
}
4545
.app-content {
46-
position: relative;
47-
padding: 0;
48-
margin: 0;
46+
position: relative;
47+
padding: 0;
48+
margin: 0;
4949
}
5050
.router-view {
51-
margin: 0;
52-
padding: 0;
51+
margin: 0;
52+
padding: 0;
5353
}
5454
</style>

‎src/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { registeGlobalComponent } from '@/components/index'
99

1010
// 语言国际化方案
1111
import '@/i18n/index'
12+
import './styles/antd.less'
1213

1314
/** 将全局静态配置注入到应用中,可以通过 this.a读取,比 provide 和 inject 手动注入更方便 */
1415
const app: ReturnType<typeof createApp> = createApp(App)

‎src/plugins/antd.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Button, Card, Row, Col, Tag, Form, Input, ConfigProvider, Select, DatePicker, Dropdown, Menu, Divider, Badge, BackTop, Carousel } from 'ant-design-vue'
2-
import '@/styles/antd.less'
32

43
/**
54
* @description 手动注册 antd-vue 组件,达到按需加载目的

‎src/plugins/index.ts

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import { createApp } from 'vue'
2-
3-
/**
4-
* @description 加载所有 Plugins
5-
* @param {ReturnType<typeofcreateApp>} app 整个应用的实例
6-
*/
7-
export function loadAllPlugins(app: ReturnType<typeof createApp>) {
8-
const files = require.context('.', true, /\.ts$/)
9-
files.keys().forEach(key => {
10-
if (key !== './index.ts') files(key).default(app)
11-
})
12-
}
1+
import { createApp } from 'vue'
2+
3+
/**
4+
* @description 加载所有 Plugins
5+
* @param {ReturnType<typeofcreateApp>} app 整个应用的实例
6+
*/
7+
export function loadAllPlugins(app: ReturnType<typeof createApp>) {
8+
const files = require.context('.', true, /\.ts$/)
9+
files.keys().forEach(key => {
10+
if (typeof files(key).default === 'function') {
11+
if (key !== './index.ts') files(key).default(app)
12+
}
13+
})
14+
}

‎vue.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module.exports = {
8383
/** 全局加载less 的 webpack 插件 */
8484
'style-resources-loader': {
8585
preProcessor: 'less',
86-
patterns: ['./src/styles/var.less']
86+
patterns: ['./src/styles/index.less']
8787
}
8888
},
8989
/**

0 commit comments

Comments
 (0)
Please sign in to comment.