当前位置:网站首页>Mobile pixel adaptation scheme
Mobile pixel adaptation scheme
2020-11-06 22:11:00 【The front end of the attack】
rem
1. stay public Public of folder html Add the configuration
principle : Create and add in the root directory of the file font-size
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>React App</title>
<script>
(function (w) {
var doc = w.document;
var docEl = doc.documentElement;
var timer;
function refersh() {
var width = docEl.getBoundingClientRect().width;
if (width > 750) {
width = 750;
}
var rem = width / 7.5;
docEl.style.fontSize = rem + "px";
}
w.addEventListener('resize', function () {
timer && clearTimeout(timer);
timer = setTimeout(refersh, 400)
})
w.addEventListener('pageshow', function () {
timer && clearTimeout(timer);
timer = setTimeout(refersh, 400)
})
})(window)
</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
2.
vm
vue-cli Automatic matching vm, Using third-party dependency packages
postcss-px-to-viewport stay vue.config.js Configuration in file :
const pxtovw = require('postcss-px-to-viewport')
module.exports = {
css: {
loaderOptions: {
css: {
// The options here are passed to css-loader
},
postcss: {
// The options here are passed to postcss-loader
plugins: [
new pxtovw({
unitToConvert: 'px',
viewportWidth: 375,
unitPrecision: 5,
propList: ['*'],
viewportUnit: 'vw',
fontViewportUnit: 'vw',
selectorBlackList: [],
minPixelValue: 1,
mediaQuery: false,
replace: true,
exclude: [/node_modules/]
})
]
}
}
}
}
版权声明
本文为[The front end of the attack]所创,转载请带上原文链接,感谢
边栏推荐
- Why is the LS command stuck when there are too many files?
- Detect certificate expiration script
- Stm32f030c6t6 compatible to replace mm32spin05pf
- 上海巨微专用蓝牙广播芯片
- 2020-08-17:详细说下数据倾斜怎么解决?
- File download manager realized by electron
- Js字符串-String字符串对象方法
- QT audio and video development 46 video transmission UDP version
- Metersphere developer's Manual
- A concise tutorial for Nacos, ribbon and feign
猜你喜欢

The use of Xunwei imx6 development board device tree kernel menuconfig

磁存储芯片STT-MRAM的特点

Windows 10 蓝牙管理页面'添加蓝牙或其他设备'选项点击无响应的解决方案

Those who have worked in China for six years and a million annual salary want to share these four points with you

How to start the hidden preferences in coda 2 on the terminal?

#JVM 类加载机制

Code generator plug-in and creator preform file analysis

小程序商城系统插件代码该如何写?怎么用代码检查添加插件是否成功?

2020-08-29:进程线程的区别,除了包含关系之外的一些区别,底层详细信息?

实验一
随机推荐
预留电池接口,内置充放电电路及电量计,迅为助力轻松搞定手持应用
Flink's datasource Trilogy: direct API
Call analysis of start method in JNI thread and callback analysis of run method
What kind of music do you need to make for a complete game?
What is the tensor in tensorflow?
Nodejs中使用jsonwebtoken(JWT)生成token的场景使用
Composition of MRAM cache
Application insights application insights use application maps to build request link views
Stickinengine architecture 12 communication protocol
Markdown tricks
Common mathematical basic formulas of recursive and backtracking algorithms
How to start the hidden preferences in coda 2 on the terminal?
2020-08-17:详细说下数据倾斜怎么解决?
2020 database technology conference helps technology upgrade
2020-08-19:TCP是通过什么机制保障可靠性的?
移动端像素适配方案
迅为iMX6开发板-设备树内核-menuconfig的使用
Detailed software engineering -- the necessary graphs in each stage
“非洲用户的付费意愿并不低”——专访四达时代研发总监张亮
Metersphere developer's Manual