vue3+ts的PC端自适应布局

1 安装
npm install amfe-flexible postcss-px2rem -S
2 在main.ts中引入
import 'amfe-flexible/index.js'
3 在已有的vue.config.js(没有就在根路径下新建一个)

  css: {
    loaderOptions: {
        postcss: {
            plugins: [
                // 设计稿宽度的1/10,比如psd宽度为1920,则为192
                require('postcss-px2rem')({remUnit: 192}),
            ]
        }
    }
}
posted on 2021-04-20 10:00  哼着老调调  阅读(1225)  评论(0编辑  收藏  举报

聊天   切换waifu!  换衣服!   拍照!   许愿吧cxy