当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- 迅为iMX6开发板-设备树内核-menuconfig的使用
- What is the tensor in tensorflow?
- 插件Bilibili新版0.5.5
- Junit测试出现 empty test suite
- [byte jumps, autumn recruitment Posts open] ohayoo! Don't leave after school, I want to ask you to play games!!!
- vue3 新特性
- 2020 database technology conference helps technology upgrade
- 上海巨微专用蓝牙广播芯片
- 谷歌浏览器实现视频播放加速功能
- Understanding formatting principles
猜你喜欢

谷歌浏览器实现视频播放加速功能

Countdown | 2020 PostgreSQL Asia Conference - agenda arrangement of Chinese sub Forum

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

STM32F030F4P6兼容灵动微MM32F031F4P6

Cloudquery v1.2.0 release

Zero basis to build a web search engine of its own

2020-08-17: how to solve data skew in detail?

NAND FLASH的接口控制设计

C and C / C + + mixed programming series 5 - GC collaboration of memory management

September 9, 2020: naked writing algorithm: two threads print numbers 1-100 in turn.
随机推荐
2020-08-24:什么是小文件?很多小文件会有什么问题?很多小文件怎么解决?(大数据)
ImageMagick - 添加水印
高速公路二维码定位报警系统
Junit测试出现 empty test suite
August 30, 2020: naked write algorithm: the nearest common ancestor of two nodes in a binary tree.
Exclusive interview of guests at | 2020 PostgreSQL Asia Conference: Wang Tao
Exclusive interview with Alibaba cloud database for 2020 PostgreSQL Asia Conference: Zeng Wenjing
[graffiti Internet of things footprints] panoramic introduction of graffiti cloud platform
Metersphere developer's Manual
Code generator plug-in and creator preform file analysis
Introduction to the development of small game cloud
Reserved battery interface, built-in charge and discharge circuit and electricity meter, quickly help easily handle hand-held applications
Python 100 cases
Zero basis to build a web search engine of its own
Method of code refactoring -- Analysis of method refactoring
Stm32f030f4p6 compatible with smart micro mm32f031f4p6
插件Bilibili新版0.5.5
C calls SendMessage to refresh the taskbar icon (the icon does not disappear at the end of forcing)
How does cglib implement multiple agents?
A good thing for working people -- to temper the will of iron and steel requires such an efficient computer