1、使用vue-cli腳手架生成項目骨架,略。
2、相關(guān)配置:
rem適配:
index.html加入以下代碼,并在head中加入以下meta;
<script> (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 = 100 * (clientWidth / 750) + 'px'; }; if (!doc.addEventListener) return; win.addEventListener(resizeEvt, recalc, false); doc.addEventListener('DOMContentLoaded', recalc, false); })(document, window); </script>3、按照mint-ui的官網(wǎng)對按需引用進行配置,.babelrc文件(安裝相關(guān)的包)
{ "presets": [ ["env", { "modules": false }] ], "plugins": ["transform-vue-jsx", "transform-runtime",["component", [ { "libraryName": "mint-ui", "style": true } ]]]}4、相關(guān)loader配置
安裝npm i postcss-px2rem-exclude --save-dev
進入build/vue-loader.conf.js文件

5、在頁面中按需引入即可

6、That's all!!!
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持武林網(wǎng)。
新聞熱點
疑難解答