請教如何在vue中引入自己寫的js文件?
比如說我在src/util下面有一個rem.js的文件,寫成自執(zhí)行函數(shù)(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',然后每個路由都運行起來了