Skip to content

Commit e148a5d

Browse files
committed
fix: IE10 support.
- deps: update - core-js@3 - @vue/cli4 - less, less-loader - eslint - remove package eslint config, save to `.eslintrc.js` - and more
1 parent 73f0a67 commit e148a5d

File tree

10 files changed

+2118
-1965
lines changed

10 files changed

+2118
-1965
lines changed

.browserslistrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> 1%
2+
last 2 versions
3+
not ie <= 10

.eslintrc.js

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true
5+
},
6+
'extends': [
7+
'plugin:vue/strongly-recommended',
8+
'@vue/standard'
9+
],
10+
rules: {
11+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
12+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
13+
'generator-star-spacing': 'off',
14+
'no-mixed-operators': 0,
15+
'vue/max-attributes-per-line': [
16+
2,
17+
{
18+
'singleline': 5,
19+
'multiline': {
20+
'max': 1,
21+
'allowFirstLine': false
22+
}
23+
}
24+
],
25+
'vue/attribute-hyphenation': 0,
26+
'vue/html-self-closing': 0,
27+
'vue/component-name-in-template-casing': 0,
28+
'vue/html-closing-bracket-spacing': 0,
29+
'vue/singleline-html-element-content-newline': 0,
30+
'vue/no-unused-components': 0,
31+
'vue/multiline-html-element-content-newline': 0,
32+
'vue/no-use-v-if-with-v-for': 0,
33+
'vue/html-closing-bracket-newline': 0,
34+
'vue/no-parsing-error': 0,
35+
'no-console': 0,
36+
'no-tabs': 0,
37+
'quotes': [
38+
2,
39+
'single',
40+
{
41+
'avoidEscape': true,
42+
'allowTemplateLiterals': true
43+
}
44+
],
45+
'semi': [
46+
2,
47+
'never',
48+
{
49+
'beforeStatementContinuationChars': 'never'
50+
}
51+
],
52+
'no-delete-var': 2,
53+
'prefer-const': [
54+
2,
55+
{
56+
'ignoreReadBeforeAssign': false
57+
}
58+
]
59+
},
60+
parserOptions: {
61+
parser: 'babel-eslint'
62+
},
63+
overrides: [
64+
{
65+
files: [
66+
'**/__tests__/*.{j,t}s?(x)',
67+
'**/tests/unit/**/*.spec.{j,t}s?(x)'
68+
],
69+
env: {
70+
jest: true
71+
}
72+
}
73+
]
74+
}

babel.config.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ if (IS_PROD) {
55
plugins.push('transform-remove-console')
66
}
77

8+
// lazy load ant-design-vue
9+
// if your use import on Demand, Use this code
10+
plugins.push(['import', {
11+
'libraryName': 'ant-design-vue',
12+
'libraryDirectory': 'es',
13+
'style': true // `style: true` 会加载 less 文件
14+
}])
15+
816
module.exports = {
917
presets: [
10-
'@vue/app',
18+
'@vue/cli-plugin-babel/preset',
1119
[
1220
'@babel/preset-env',
1321
{
14-
'useBuiltIns': 'entry'
22+
'useBuiltIns': 'entry',
23+
'corejs': 3
1524
}
1625
]
1726
],
1827
plugins
19-
// if your use import on Demand, Use this code
20-
// ,
21-
// plugins: [
22-
// [ 'import', {
23-
// 'libraryName': 'ant-design-vue',
24-
// 'libraryDirectory': 'es',
25-
// 'style': true // `style: true` 会加载 less 文件
26-
// } ]
27-
// ]
2828
}

package.json

+23-95
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
22
"name": "vue-antd-pro",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
77
"build": "vue-cli-service build",
8-
"build:preview": "vue-cli-service build --mode preview",
8+
"test:unit": "vue-cli-service test:unit",
99
"lint": "vue-cli-service lint",
10+
"build:preview": "vue-cli-service build --mode preview",
1011
"lint:nofix": "vue-cli-service lint --no-fix",
11-
"test:unit": "vue-cli-service test:unit",
1212
"postinstall": "opencollective-postinstall"
1313
},
1414
"dependencies": {
1515
"@antv/data-set": "^0.10.2",
16-
"ant-design-vue": "1.4.0-beta.0",
16+
"ant-design-vue": "1.4.2",
1717
"axios": "^0.19.0",
18-
"core-js": "2.6.9",
18+
"core-js": "^3.1.2",
1919
"enquire.js": "^2.1.6",
2020
"lodash.get": "^4.4.2",
2121
"lodash.pick": "^4.4.0",
@@ -30,106 +30,34 @@
3030
"vue-ls": "^3.2.1",
3131
"vue-quill-editor": "^3.0.6",
3232
"vue-router": "^3.1.2",
33-
"vue-svg-component-runtime": "^1.0.1",
3433
"vuex": "^3.1.1",
35-
"wangeditor": "^3.1.1"
34+
"wangeditor": "^3.1.1",
35+
"vue-svg-component-runtime": "^1.0.1"
3636
},
3737
"devDependencies": {
3838
"@ant-design/colors": "^3.2.1",
39-
"@babel/polyfill": "7.2.5",
40-
"@vue/cli-plugin-babel": "^3.11.0",
41-
"@vue/cli-plugin-eslint": "^3.11.0",
42-
"@vue/cli-plugin-unit-jest": "^3.11.0",
43-
"@vue/cli-service": "^3.11.0",
39+
"@vue/cli-plugin-babel": "^4.0.4",
40+
"@vue/cli-plugin-eslint": "^4.0.4",
41+
"@vue/cli-plugin-router": "^4.0.4",
42+
"@vue/cli-plugin-unit-jest": "^4.0.4",
43+
"@vue/cli-plugin-vuex": "^4.0.4",
44+
"@vue/cli-service": "^4.0.4",
4445
"@vue/eslint-config-standard": "^4.0.0",
45-
"@vue/test-utils": "^1.0.0-beta.20",
46-
"babel-core": "7.0.0-bridge.0",
47-
"babel-eslint": "^10.0.3",
48-
"babel-jest": "^23.6.0",
49-
"babel-plugin-import": "^1.11.0",
46+
"@vue/test-utils": "^1.0.0-beta.29",
47+
"babel-eslint": "^10.0.1",
48+
"babel-plugin-import": "^1.12.2",
5049
"babel-plugin-transform-remove-console": "^6.9.4",
51-
"eslint": "^5.8.0",
50+
"eslint": "^5.16.0",
5251
"eslint-plugin-html": "^5.0.0",
5352
"eslint-plugin-vue": "^5.2.3",
54-
"less": "3.9.0",
55-
"less-loader": "4.1.0",
56-
"opencollective": "^1.0.3",
57-
"opencollective-postinstall": "^2.0.2",
58-
"vue-svg-icon-loader": "^2.1.1",
53+
"less": "^3.0.4",
54+
"less-loader": "^5.0.0",
5955
"vue-template-compiler": "^2.6.10",
60-
"webpack-theme-color-replacer": "^1.2.17"
61-
},
62-
"eslintConfig": {
63-
"root": true,
64-
"env": {
65-
"node": true
66-
},
67-
"extends": [
68-
"plugin:vue/strongly-recommended",
69-
"@vue/standard"
70-
],
71-
"parserOptions": {
72-
"parser": "babel-eslint"
73-
},
74-
"rules": {
75-
"generator-star-spacing": "off",
76-
"no-mixed-operators": 0,
77-
"vue/max-attributes-per-line": [
78-
2,
79-
{
80-
"singleline": 5,
81-
"multiline": {
82-
"max": 1,
83-
"allowFirstLine": false
84-
}
85-
}
86-
],
87-
"vue/attribute-hyphenation": 0,
88-
"vue/html-self-closing": 0,
89-
"vue/component-name-in-template-casing": 0,
90-
"vue/html-closing-bracket-spacing": 0,
91-
"vue/singleline-html-element-content-newline": 0,
92-
"vue/no-unused-components": 0,
93-
"vue/multiline-html-element-content-newline": 0,
94-
"vue/no-use-v-if-with-v-for": 0,
95-
"vue/html-closing-bracket-newline": 0,
96-
"vue/no-parsing-error": 0,
97-
"no-console": 0,
98-
"no-tabs": 0,
99-
"quotes": [
100-
2,
101-
"single",
102-
{
103-
"avoidEscape": true,
104-
"allowTemplateLiterals": true
105-
}
106-
],
107-
"semi": [
108-
2,
109-
"never",
110-
{
111-
"beforeStatementContinuationChars": "never"
112-
}
113-
],
114-
"no-delete-var": 2,
115-
"prefer-const": [
116-
2,
117-
{
118-
"ignoreReadBeforeAssign": false
119-
}
120-
]
121-
}
122-
},
123-
"postcss": {
124-
"plugins": {
125-
"autoprefixer": {}
126-
}
56+
"vue-svg-icon-loader": "^2.1.1",
57+
"webpack-theme-color-replacer": "^1.2.17",
58+
"opencollective": "^1.0.3",
59+
"opencollective-postinstall": "^2.0.2"
12760
},
128-
"browserslist": [
129-
"> 1%",
130-
"last 2 versions",
131-
"not ie <= 10"
132-
],
13361
"collective": {
13462
"type": "opencollective",
13563
"url": "https://opencollective.com/ant-design-pro-vue"

postcss.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
plugins: {
3+
autoprefixer: {}
4+
}
5+
}

src/core/lazy_use.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ import Viser from 'viser-vue'
88

99
// ext library
1010
import VueClipboard from 'vue-clipboard2'
11+
import MultiTab from '@/components/MultiTab'
12+
import PageLoading from '@/components/PageLoading'
1113
import PermissionHelper from '@/utils/helper/permission'
1214
import './directives/action'
1315

1416
VueClipboard.config.autoSetContainer = true
1517

1618
Vue.use(Viser)
17-
19+
Vue.use(MultiTab)
20+
Vue.use(PageLoading)
1821
Vue.use(VueStorage, config.storageOptions)
1922
Vue.use(VueClipboard)
2023
Vue.use(PermissionHelper)

src/main.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// ie polyfill
2-
import '@babel/polyfill'
1+
// with polyfills
2+
import 'core-js/stable'
3+
import 'regenerator-runtime/runtime'
34

45
import Vue from 'vue'
56
import App from './App.vue'
@@ -8,10 +9,11 @@ import store from './store/'
89
import { VueAxios } from './utils/request'
910

1011
// mock
12+
// WARNING: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.
1113
import './mock'
1214

1315
import bootstrap from './core/bootstrap'
14-
import './core/use'
16+
import './core/lazy_use'
1517
import './permission' // permission control
1618
import './utils/filter' // global filter
1719

src/mock/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import Mock from 'mockjs2'
1+
import { isIE } from '@/utils/util'
22

33
// 判断环境不是 prod 或者 preview 是 true 时,加载 mock 服务
44
if (process.env.NODE_ENV !== 'production' || process.env.VUE_APP_PREVIEW === 'true') {
5+
if (isIE()) {
6+
console.error('ERROR: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.')
7+
}
58
// 使用同步加载依赖
69
// 防止 vuex 中的 GetInfo 早于 mock 运行,导致无法 mock 请求返回结果
710
console.log('mock mounting')
11+
const Mock = require('mockjs2')
812
require('./services/auth')
913
require('./services/user')
1014
require('./services/manage')

src/utils/util.js

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ export function handleScrollHeader (callback) {
4545
)
4646
}
4747

48+
export function isIE () {
49+
const bw = window.navigator.userAgent
50+
const compare = (s) => bw.indexOf(s) >= 0
51+
const ie11 = (() => 'ActiveXObject' in window)()
52+
return compare('MSIE') || ie11
53+
}
54+
4855
/**
4956
* Remove loading animate
5057
* @param id parent element id or class

0 commit comments

Comments
 (0)