px2rem
-
构建项目(vue-cli3.0)
vue create hello-world (Manuall select features)
-
安装px2rem-loader(devDependencies)
npm install px2rem-loader --save-dev
-
移动端适配解决npm包 "lib-flexible" (dependencies)
npm install lib-flexible --save
-
main.js中引入 "lib-flexible"
import 'lib-flexible' // 移动端适配 (目录: hello-world/src/main.js)
-
Create new "vue.config.js" file if without "vue.config.js" (目录: hello-world/vue.config.js)
module.exports = { chainWebpack: (config) => { <!--新增的内容--> config.module .rule('css') .test(/\.css$/) .oneOf('vue') .resourceQuery(/\?vue/) .use('px2rem') .loader('px2rem-loader') .o