新建resize.js文件 ,并放在public文件夹下的swiper文件夹(这个文件夹随便放的,只要是在public里面引入 问题不大)
// 转化rem单位 1rem = 100px
(function (doc, win) {
var docEl = doc.documentElement,
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
recalc = function () {
var clientWidth = docEl.clientWidth;
if (!clientWidth) return;
if (clientWidth >= 750) {
docEl.style.fontSize = '100px';
} else {
docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
}
var html = document.getElementsByTagName('html')[0];
var settedFs = sett