手機端適配方案 媒體查詢和flexbale
阿新 • • 發佈:2018-11-07
b- port rac bject cti span key object keyword
方法一 flexible
一、npm 包安裝
lib-flexible 淘寶適配方案
px2rem px自動轉rem
npm install lib-flexible --save
npm install px2rem-loader
二、在main.js中引入lib-flexible**
import ‘lib-flexible/flexible.js‘
三、配置build/utils.js
var px2remLoader = {
loader: ‘px2rem-loader‘,
options: {
remUnit: 75
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
var loaders = [cssLoader,px2remLoader]
if (loader) {
loaders.push({
loader: loader + ‘-loader‘,
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
方法二媒體查詢
手機端適配方案 媒體查詢和flexbale