当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
猜你喜欢

Introduction to Huawei cloud micro certification examination

2020-09-04: do you understand the function call convention?

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

2020-09-04:函数调用约定了解么?

2020-08-20: the difference between go and python?

【涂鸦物联网足迹】涂鸦云平台全景介绍

This project allows you to quickly learn about a programming language in a few minutes

Composition of MRAM cache

The isolation level of transaction and its problems

2020-08-20:GO语言中的协程与Python中的协程的区别?
随机推荐
The Interpreter pattern of behavior pattern
Epu360: all the H5 templates you want are here, e-book, big turntable, red envelope rain, questionnaire survey
Stickinengine architecture 12 communication protocol
Cloudquery v1.2.0 release
The essence of transaction and the principle of deadlock
The memorandum model of behavior model
2020-08-15: under what circumstances should data tasks be optimized?
Windows 10 蓝牙管理页面'添加蓝牙或其他设备'选项点击无响应的解决方案
QT audio and video development 46 video transmission UDP version
Erd-online free online database modeling tool
List to map (split the list according to the key, and the value of the same key is a list)
大佬们如何在nginx镜像里面增加模块?
Big data processing black Technology: revealing the parallel computing technology of Pb level data warehouse gaussdb (DWS)
2020-08-24:什么是小文件?很多小文件会有什么问题?很多小文件怎么解决?(大数据)
Qt音视频开发46-视频传输UDP版
Junit测试出现 empty test suite
Hdu3974 assign the task segment tree DFS order
如何才能快速正确的部署甘特图
2020-08-17:详细说下数据倾斜怎么解决?
Application insights application insights use application maps to build request link views