转载自: https://blog.csdn.net/lianwenxiu/article/details/87897453
放到index.html下
750 //设计图宽度
(function(doc, win) {
var docE1 = doc.documentElement,
resizeEvt = 'orientationchange' in window ? 'orientationchange': 'resize',
recalc = function() {
var clientWidth = docE1.clientWidth;
if (!clientWidth) return;
docE1.style.fontSize = 100 * (clientWidth / 750) + 'px';
};
if (!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);