Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit be07802

Browse files
committed
update
1 parent da54a63 commit be07802

File tree

6 files changed

+272
-49
lines changed

6 files changed

+272
-49
lines changed

‎package-lock.json‎

Lines changed: 129 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
},
1010
"dependencies": {
1111
"@fortawesome/fontawesome-free": "^5.10.1",
12+
"axios": "^0.19.0",
1213
"core-js": "^2.6.5",
1314
"cube-ui": "~1.12.15",
1415
"echarts": "^4.2.1",
1516
"vue": "^2.6.10",
1617
"vue-echarts": "^4.0.2",
1718
"vue-router": "^3.0.3",
18-
"vuex": "^3.0.1"
19+
"vuex": "^3.0.1",
20+
"vve-vue-axios": "^1.0.0"
1921
},
2022
"devDependencies": {
2123
"@vue/cli-plugin-babel": "^3.7.0",
@@ -24,6 +26,7 @@
2426
"babel-eslint": "^10.0.1",
2527
"eslint": "^5.16.0",
2628
"eslint-plugin-vue": "^5.0.0",
29+
"postcss-pxtorem": "^4.0.1",
2730
"sass": "^1.18.0",
2831
"sass-loader": "^7.1.0",
2932
"stylus": "^0.54.5",

‎postcss.config.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
module.exports = {
22
plugins: {
33
autoprefixer: {},
4+
'postcss-pxtorem': {
5+
rootValue: 37.5,
6+
propList: ['*']
7+
},
48
}
59
}

‎src/amfe-flexible.js‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* https://github.com/amfe/lib-flexible
3+
*/
4+
(function flexible (window, document) {
5+
var docEl = document.documentElement
6+
var dpr = window.devicePixelRatio || 1
7+
8+
// adjust body font size
9+
function setBodyFontSize () {
10+
if (document.body) {
11+
// document.body.style.fontSize = (12 * dpr) + 'px'
12+
document.body.style.fontSize = 16 + 'px'
13+
}
14+
else {
15+
document.addEventListener('DOMContentLoaded', setBodyFontSize)
16+
}
17+
}
18+
setBodyFontSize();
19+
20+
// set 1rem = viewWidth / 10
21+
function setRemUnit () {
22+
var rem = docEl.clientWidth / 10
23+
docEl.style.fontSize = rem + 'px'
24+
}
25+
26+
setRemUnit()
27+
28+
// reset rem unit on page resize
29+
window.addEventListener('resize', setRemUnit)
30+
window.addEventListener('pageshow', function (e) {
31+
if (e.persisted) {
32+
setRemUnit()
33+
}
34+
})
35+
36+
// detect 0.5px supports
37+
if (dpr >= 2) {
38+
var fakeBody = document.createElement('body')
39+
var testElement = document.createElement('div')
40+
testElement.style.border = '.5px solid transparent'
41+
fakeBody.appendChild(testElement)
42+
docEl.appendChild(fakeBody)
43+
if (testElement.offsetHeight === 1) {
44+
docEl.classList.add('hairlines')
45+
}
46+
docEl.removeChild(fakeBody)
47+
}
48+
}(window, document))

‎src/main.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import './amfe-flexible'
12
import Vue from 'vue'
3+
import axios from 'axios'
4+
import VueAxios from 'vve-vue-axios'
25
// fontawesome 图标
36
import '@fortawesome/fontawesome-free/css/all.css'
47
import './cube-ui'
@@ -10,6 +13,8 @@ import store from './store'
1013

1114
Vue.config.productionTip = false
1215

16+
Vue.use(VueAxios, axios)
17+
1318
new Vue({
1419
router,
1520
store,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /