Skip to content

Commit

Permalink
fix(thme): 修改 ant-design-vue自定义主题在 build 之后无法覆盖成功的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
白唯 committed Oct 31, 2020
1 parent 023d4ee commit 29a591d
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 72 deletions.
8 changes: 1 addition & 7 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
NODE_ENV=development
// VUE_APP_BASE_URL = //10.10.10.115:8002
VUE_APP_BASE_URL = //apitest.cuidc.net
VUE_APP_BASE_EDITOR_URL = //editorapitest.cuidc.net
VUE_APP_EDITOR_JS = //editortest.cuidc.net
VUE_APP_UPLOADED_URL = //bus.cuidc.net/
VUE_APP_EDITOR_URL_AUTH = a453964db52ff10ad0a3adf4be4dd4e5
NODE_ENV=development
7 changes: 1 addition & 6 deletions .env.preview
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
NODE_ENV=production
VUE_APP_BASE_URL = //apitest.cuidc.net
VUE_APP_BASE_EDITOR_URL = //editorapitest.cuidc.net
VUE_APP_UPLOADED_URL = //bus.cuidc.net/
VUE_APP_EDITOR_JS = //editortest.cuidc.net
VUE_APP_EDITOR_URL_AUTH = 7f35b26c51e980153763ee996542f541
NODE_ENV=production
13 changes: 4 additions & 9 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
NODE_ENV=production
VUE_APP_BASE_URL = //api.cuidc.net
VUE_APP_BASE_EDITOR_URL = //editorapi.cuidc.net
VUE_APP_EDITOR_JS = //editor.cuidc.net
VUE_APP_UPLOADED_URL = //bus-acc.cuidc.net/
VUE_APP_EDITOR_URL_AUTH = e3e5e9488f3e2e2857fc045b9c48566b



NODE_ENV=production



7 changes: 3 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
presets: ['@vue/cli-plugin-babel/preset'],
plugins: [['import', { libraryName: 'ant-design-vue', libraryDirectory: 'es', style: true }]]
}
module.exports = {
presets: ['@vue/cli-plugin-babel/preset']
}
Binary file added src/assets/fonts/Helvetica.eot
Binary file not shown.
Binary file added src/assets/fonts/Helvetica.otf
Binary file not shown.
Binary file added src/assets/fonts/Helvetica.ttf
Binary file not shown.
Binary file added src/assets/fonts/Helvetica.woff
Binary file not shown.
Binary file added src/assets/fonts/Helvetica.woff2
Binary file not shown.
64 changes: 32 additions & 32 deletions src/layout/AppLayout.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<template>
<div class="app-layout">
<router-view v-if="fullScreenMode" />
<div class="app-content" v-else>
<app-header />
<div id="nav">
<router-link to="/">Home</router-link> | <router-link to="/about">About</router-link> | <router-link to="/contact">Contact</router-link> |
<router-link to="/tests">组件测试</router-link>
</div>
<router-view class="router-view" />
<app-footer />
</div>
</div>
<div class="app-layout">
<router-view v-if="fullScreenMode" />
<div class="app-content" v-else>
<app-header />
<div id="nav">
<router-link to="/">Home</router-link> | <router-link to="/about">About</router-link> | <router-link to="/contact">Contact</router-link> |
<router-link to="/tests">组件测试</router-link>
</div>
<router-view />
<app-footer />
</div>
</div>
</template>

<script>
Expand All @@ -20,35 +20,35 @@ import { defineComponent, ref, watch } from 'vue'
import { useRouter } from 'vue-router'

export default defineComponent({
components: {
AppFooter,
AppHeader
},
setup() {
const fullScreenMode = ref(true)
const router = useRouter()
watch(router.currentRoute, () => {
fullScreenMode.value = Boolean(router.currentRoute.value.meta?.fullScreen)
})
components: {
AppFooter,
AppHeader
},
setup() {
const fullScreenMode = ref(true)
const router = useRouter()
watch(router.currentRoute, () => {
fullScreenMode.value = Boolean(router.currentRoute.value.meta?.fullScreen)
})

return {
fullScreenMode
}
}
return {
fullScreenMode
}
}
})
</script>

<style lang="less" scoped>
.app-layout {
height: 100%;
height: 100%;
}
.app-content {
position: relative;
padding: 0;
margin: 0;
position: relative;
padding: 0;
margin: 0;
}
.router-view {
margin: 0;
padding: 0;
margin: 0;
padding: 0;
}
</style>
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { registeGlobalComponent } from '@/components/index'

// 语言国际化方案
import '@/i18n/index'
import './styles/antd.less'

/** 将全局静态配置注入到应用中,可以通过 this.a读取,比 provide 和 inject 手动注入更方便 */
const app: ReturnType<typeof createApp> = createApp(App)
Expand Down
1 change: 0 additions & 1 deletion src/plugins/antd.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Button, Card, Row, Col, Tag, Form, Input, ConfigProvider, Select, DatePicker, Dropdown, Menu, Divider, Badge, BackTop, Carousel } from 'ant-design-vue'
import '@/styles/antd.less'

/**
* @description 手动注册 antd-vue 组件,达到按需加载目的
Expand Down
26 changes: 14 additions & 12 deletions src/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { createApp } from 'vue'

/**
* @description 加载所有 Plugins
* @param {ReturnType<typeofcreateApp>} app 整个应用的实例
*/
export function loadAllPlugins(app: ReturnType<typeof createApp>) {
const files = require.context('.', true, /\.ts$/)
files.keys().forEach(key => {
if (key !== './index.ts') files(key).default(app)
})
}
import { createApp } from 'vue'

/**
* @description 加载所有 Plugins
* @param {ReturnType<typeofcreateApp>} app 整个应用的实例
*/
export function loadAllPlugins(app: ReturnType<typeof createApp>) {
const files = require.context('.', true, /\.ts$/)
files.keys().forEach(key => {
if (typeof files(key).default === 'function') {
if (key !== './index.ts') files(key).default(app)
}
})
}
2 changes: 1 addition & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module.exports = {
/** 全局加载less 的 webpack 插件 */
'style-resources-loader': {
preProcessor: 'less',
patterns: ['./src/styles/var.less']
patterns: ['./src/styles/index.less']
}
},
/**
Expand Down

0 comments on commit 29a591d

Please sign in to comment.