vue中rem的转换
2024-10-22 02:41:47
1 function rems(doc: any, win: any): void {
2 let docEl = doc.documentElement,
3 resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
4 recalc = function () {
5 let clientWidth = docEl.clientWidth;
6 if (!clientWidth) return;
7 docEl.style.fontSize = 20 * (clientWidth / 750) + 'px';
8 };
9 if (!doc.addEventListener) return;
10 win.addEventListener(resizeEvt, recalc, false);
11 doc.addEventListener('DOMContentLoaded', recalc, false);
12 }
13 export default {
14 return : rems(document,window)
15 }
最新文章
- Lua 安全调用 metatable 的简单应用
- 爬虫 htmlUnit遇到Cannot locate declared field class org.apache.http.impl.client.HttpClientBuilder.dnsResolve错误
- 20145330第十周《Java学习笔记》
- JavaScript tasks, microtasks, queues and schedules
- Core Java Volume I — 4.4. Static Fields and Methods
- jQuery骨架
- mfc简易加法
- Qt之QComboBox定制(二)
- Pycharm汉化
- 限时订单实现方案(DelayQueue、ActiveMq)
- python中的optionParser模块
- 渗透测试(theharvester >;>;steghide)
- 《Effective C++》笔记
- 使用SonarCloud对.NET Core项目进行静态代码分析
- SpringBoot集成RocketMQ
- 奇怪吸引子---LorenzStenflo
- hdoj:题目分类
- VBA:Excel使用SQL进行查询
- Notes of Daily Scrum Meeting(11.4)
- IOS TableView滑动不灵敏问题