浮云间
比如说我在src/util下面有一个rem.js的文件,写成自执行函数(function(doc, win) {var docEl = doc.documentElement,resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',recalc = function() {var clientWidth = docEl.clientWidth;if (!clientWidth) return;docEl.style.fontSize = (clientWidth / 12) + 'px';};if (!doc.addEventListener) return;win.addEventListener(resizeEvt, recalc, false);doc.addEventListener('DOMContentLoaded', recalc, false);})(document, window);然后在main.js中引用import './util/rem',然后每个路由都运行起来了