From a70422b017c5a08a058d5568602ffdcbfe1525ea Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 4 Nov 2021 15:21:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E5=85=A5=E7=AD=89=E6=AF=94=E9=80=82?= =?UTF-8?q?=E9=85=8D=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue.config.js | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/vue.config.js b/vue.config.js index 6ffcb72..44813e8 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,19 +1,33 @@ -const Setting = require('./src/setting.env') +// 引入等比适配插件 +const px2rem = require("postcss-px2rem"); + +// 配置基本大小 +const postcss = px2rem({ + // 基准大小 baseSize,需要和rem.js中相同 + remUnit: 16 +}); + +const Setting = require("./src/setting.env"); // 使用等比适配插件 module.exports = { - lintOnSave: true, - css: { - loaderOptions: { - sass: { - prependData: `@import "@/styles/var.scss";` - }, + lintOnSave: true, + css: { + loaderOptions: { + postcss: { + plugins: [ + postcss + ] + }, + sass: { + prependData: `@import "@/styles/var.scss";` + } + } + }, + publicPath: Setting.publicPath, + outputDir: Setting.outputDir, + assetsDir: Setting.assetsDir, + devServer: { + port: 8082 // 固定端口 } - }, - publicPath: Setting.publicPath, - outputDir: Setting.outputDir, - assetsDir: Setting.assetsDir, - devServer: { - port: 8082 // 固定端口 - } -} \ No newline at end of file +}; \ No newline at end of file