Skip to content

Commit 4bed861

Browse files
committed
chore: fix ThemeColorReplacer selector
and cleanup - fix ThemeColorReplacer selector - add env `VUE_APP_API_BASE_URL` - cleanup. (remove utils/storage.js)
1 parent 0a2e2eb commit 4bed861

File tree

10 files changed

+19
-146
lines changed

10 files changed

+19
-146
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
NODE_ENV=production
22
VUE_APP_PREVIEW=false
3+
VUE_APP_API_BASE_URL=/api

.env.preview

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
NODE_ENV=production
22
VUE_APP_PREVIEW=true
3+
VUE_APP_API_BASE_URL=/api

README.md

+2-34
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
English | [简体中文](./README.zh-CN.md)
22

33
<h1 align="center">Ant Design Pro Vue</h1>
4-
54
<div align="center">
65
An out-of-box UI solution for enterprise applications as a Vue boilerplate. based on <a href="https://vuecomponent.github.io/ant-design-vue/docs/vue/introduce-cn/" target="_blank">Ant Design of Vue</a>
76
</div>
@@ -92,39 +91,8 @@ yarn run lint
9291

9392
- Load on Demand: modify `/src/main.js` L14, replace to `import './core/lazy_use'` code.
9493

95-
- Customize Theme: `vue.config.js`
96-
eg:
97-
```ecmascript 6
98-
css: {
99-
loaderOptions: {
100-
less: {
101-
modifyVars: {
102-
/* Less variables, required modifyVars*/
103-
104-
'primary-color': '#F5222D',
105-
'link-color': '#F5222D',
106-
'border-radius-base': '4px',
107-
},
108-
javascriptEnabled: true,
109-
}
110-
}
111-
}
112-
```
113-
- **polyfill**
114-
115-
- remove polyfill:
116-
> [Vue CLI Polyfill](https://cli.vuejs.org/zh/guide/browser-compatibility.html#usebuiltins-usage)
117-
118-
- remove `import '@babel/polyfill'` field in `src/main.js`
119-
- `babel.conflg.js` remove
120-
```ecmascript 6
121-
[
122-
'@babel/preset-env',
123-
{
124-
'useBuiltIns': 'entry'
125-
}
126-
]
127-
```
94+
- Customize Theme: [Custom Theme Config](https://github.com/kokoroli/antd-awesome/blob/master/docs/Ant_Design_%E6%A0%B7%E5%BC%8F%E8%A6%86%E7%9B%96.md)
95+
12896

12997
## Browsers support
13098

README.zh-CN.md

+4-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[English](./README.md) | 简体中文
22

33
<h1 align="center">Ant Design Pro Vue</h1>
4-
54
<div align="center">
65
An out-of-box UI solution for enterprise applications as a Vue boilerplate. based on <a href="https://vuecomponent.github.io/ant-design-vue/docs/vue/introduce-cn/" target="_blank">Ant Design of Vue</a>
76
</div>
@@ -92,29 +91,13 @@ yarn run lint
9291

9392
- **关于 Issue 反馈 (重要!重要!重要!) 请在开 *Issue* 前,先阅读该内容:[Issue / PR 编写建议](https://github.com/sendya/ant-design-pro-vue/issues/90)**
9493

95-
- 项目使用的 [vue-cli3](https://cli.vuejs.org/guide/), 请更新您的 cli
94+
- 项目使用的 [vue-cli3](https://cli.vuejs.org/guide/), 请确保你所使用的 vue-cli 是新版,并且已经学习 cli 官方文档使用教程
9695

9796
- 关闭 Eslint (不推荐) 移除 `package.json``eslintConfig` 整个节点代码, `vue.config.js` 下的 `lintOnSave` 值改为 `false`
9897

99-
- 开启组件按需加载 `/src/main.js` L7 修改为 `import './core/lazy_use'`
100-
101-
- 修改 Ant Design 配色,在文件 `vue.config.js` 中,其他 less 变量覆盖参考 [ant design](https://ant.design/docs/react/customize-theme-cn) 官方说明
102-
```ecmascript 6
103-
css: {
104-
loaderOptions: {
105-
less: {
106-
modifyVars: {
107-
/* less 变量覆盖,用于自定义 ant design 主题 */
108-
109-
'primary-color': '#F5222D',
110-
'link-color': '#F5222D',
111-
'border-radius-base': '4px',
112-
},
113-
javascriptEnabled: true,
114-
}
115-
}
116-
}
117-
```
98+
- 开启组件按需加载 `/src/main.js` L14 修改为 `import './core/lazy_use'`
99+
100+
- [修改 Ant Design 配色](https://github.com/kokoroli/antd-awesome/blob/master/docs/Ant_Design_%E6%A0%B7%E5%BC%8F%E8%A6%86%E7%9B%96.md)
118101
- **使用polyfill兼容至 IE10**
119102

120103
## 浏览器兼容

src/core/bootstrap.js

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {
1616
import config from '@/config/defaultSettings'
1717

1818
export default function Initializer () {
19+
console.log(`API_URL: ${process.env.VUE_APP_API_BASE_URL}`)
20+
1921
store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true))
2022
store.commit('TOGGLE_THEME', Vue.ls.get(DEFAULT_THEME, config.navTheme))
2123
store.commit('TOGGLE_LAYOUT_MODE', Vue.ls.get(DEFAULT_LAYOUT_MODE, config.layout))

src/main.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ Vue.use(VueAxios)
2323
new Vue({
2424
router,
2525
store,
26-
created () {
27-
bootstrap()
28-
},
26+
created: bootstrap,
2927
render: h => h(App)
3028
}).$mount('#app')

src/utils/request.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import Vue from 'vue'
22
import axios from 'axios'
33
import store from '@/store'
4-
import {
5-
VueAxios
6-
} from './axios'
74
import notification from 'ant-design-vue/es/notification'
8-
import {
9-
ACCESS_TOKEN
10-
} from '@/store/mutation-types'
5+
import { VueAxios } from './axios'
6+
import { ACCESS_TOKEN } from '@/store/mutation-types'
117

128
// 创建 axios 实例
139
const service = axios.create({
14-
baseURL: '/api', // api base_url
10+
baseURL: process.env.VUE_APP_API_BASE_URL, // api base_url
1511
timeout: 6000 // 请求超时时间
1612
})
1713

src/utils/storage.js

-77
This file was deleted.

src/views/dashboard/Workplace.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ export default {
190190
this.avatar = this.userInfo.avatar
191191
192192
getRoleList().then(res => {
193-
console.log('workplace -> call getRoleList()', res)
193+
// console.log('workplace -> call getRoleList()', res)
194194
})
195195
196196
getServiceList().then(res => {
197-
console.log('workplace -> call getServiceList()', res)
197+
// console.log('workplace -> call getServiceList()', res)
198198
})
199199
},
200200
mounted () {

vue.config.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ module.exports = {
2020
matchColors: getAntdSerials('#1890ff'), // 主色系列
2121
// 改变样式选择器,解决样式覆盖问题
2222
changeSelector (selector) {
23+
console.log('selector', selector)
2324
switch (selector) {
2425
case '.ant-calendar-today .ant-calendar-date':
25-
return ':not(.ant-calendar-selected-date)' + selector
26+
return ':not(.ant-calendar-selected-date):not(.ant-calendar-selected-day)' + selector
2627
case '.ant-btn:focus,.ant-btn:hover':
2728
return '.ant-btn:focus:not(.ant-btn-primary),.ant-btn:hover:not(.ant-btn-primary)'
2829
case '.ant-steps-item-process .ant-steps-item-icon > .ant-steps-icon':
29-
return null
30+
return ':not(.ant-steps-item-process)' + selector
3031
case '.ant-btn.active,.ant-btn:active':
3132
return '.ant-btn.active:not(.ant-btn-primary),.ant-btn:active:not(.ant-btn-primary)'
3233
case '.ant-menu-horizontal>.ant-menu-item-active,.ant-menu-horizontal>.ant-menu-item-open,.ant-menu-horizontal>.ant-menu-item-selected,.ant-menu-horizontal>.ant-menu-item:hover,.ant-menu-horizontal>.ant-menu-submenu-active,.ant-menu-horizontal>.ant-menu-submenu-open,.ant-menu-horizontal>.ant-menu-submenu-selected,.ant-menu-horizontal>.ant-menu-submenu:hover':

0 commit comments

Comments
 (0)