Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
web-framework-temp
/
vue-cli3-vt-template-master
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
c77e76fb
authored
2021-11-12 14:29:11 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
兼容部分华为手机适配方案
1 parent
e81d3061
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
20 deletions
package.json
postcss.config.js
src/main.js
package.json
View file @
c77e76f
...
...
@@ -40,6 +40,7 @@
"eslint"
:
"^5.16.0"
,
"eslint-plugin-vue"
:
"^5.0.0"
,
"node-sass"
:
"^5.0.0"
,
"postcss-px-to-viewport"
:
"^1.1.1"
,
"sass-loader"
:
"^10.1.0"
,
"vue-template-compiler"
:
"^2.6.10"
}
...
...
postcss.config.js
View file @
c77e76f
const
AutoPrefixer
=
require
(
"autoprefixer"
);
const
px2rem
=
require
(
"postcss-px2rem"
);
module
.
exports
=
({
file
})
=>
{
let
remUnit
;
// file.dirname是绝对地址,所以项目名,文件目录不能带 'vant'
if
(
file
&&
file
.
dirname
&&
file
.
dirname
.
indexOf
(
"vant"
)
>
-
1
)
{
remUnit
=
37.5
;
}
else
{
remUnit
=
75
;
// postcss.config,js
// https://blog.csdn.net/StayInCat/article/details/120542066
module
.
exports
=
{
'plugins'
:
{
'postcss-px-to-viewport'
:
{
unitToConvert
:
'px'
,
// 需要转换的单位,默认为 px
viewportWidth
:
750
,
// 设计稿的视口宽度
unitPrecision
:
3
,
// 单位转换后保留的精度
viewportUnit
:
'vw'
,
// 希望使用的视口单位
selectorBlackList
:
[],
// 需要忽略的CSS选择器
minPixelValue
:
1
,
// 设置最小的转换数值
mediaQuery
:
true
,
// 媒体查询中的单位是否需要转换
exclude
:
[
/node_modules/
],
// 忽略某些文件夹下的文件或特定文件
}
}
return
{
plugins
:
[
px2rem
({
remUnit
:
remUnit
,
}),
AutoPrefixer
({
browsers
:
[
"last 20 versions"
,
"android >= 4.0"
]
})]
};
};
}
...
...
src/main.js
View file @
c77e76f
...
...
@@ -30,7 +30,8 @@ import {
Tabbar
,
TabbarItem
,
Icon
,
Toast
Toast
,
Button
}
from
'vant'
;
Vue
.
use
(
Swipe
).
use
(
SwipeItem
)
...
...
@@ -40,6 +41,7 @@ Vue.use(Swipe).use(SwipeItem)
.
use
(
Popup
)
.
use
(
Tabbar
).
use
(
TabbarItem
)
.
use
(
Icon
)
.
use
(
Button
)
.
use
(
Toast
);
new
Vue
({
...
...
Please
register
or
sign in
to post a comment