From aa3bb707e63e9764e9591474c7efba60b0699fd9 Mon Sep 17 00:00:00 2001 From: dengtongyu Date: Wed, 8 Dec 2021 19:12:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsconfig.json | 14 ++++++++++++++ package.json | 2 ++ postcss.config.js | 5 +++++ vue.config.js | 12 ++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 jsconfig.json diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..9ab978e --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs", + "allowSyntheticDefaultImports": true, + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } + }, + "exclude": [ + "node_modules" + ] + } \ No newline at end of file diff --git a/package.json b/package.json index 8a4507d..bd3eea4 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "axios": "^0.19.2", + "postcss-design-convert": "^1.1.3", "vant": "^2.12.36", "vue": "^2.6.11", "vue-router": "^3.1.6", @@ -31,6 +32,7 @@ "postcss-write-svg": "^3.0.1", "sass": "^1.26.3", "sass-loader": "^8.0.2", + "svg-sprite-loader": "^6.0.11", "vue-template-compiler": "^2.6.11" } } diff --git a/postcss.config.js b/postcss.config.js index b498fe8..22cb38c 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -13,5 +13,10 @@ module.exports = { minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值 mediaQuery: false, // 允许在媒体查询中转换`px` }, + "postcss-design-convert": { + multiple: 2, + units: ["vw"], + selector: /^\.yzy-/, + }, }, }; diff --git a/vue.config.js b/vue.config.js index 34a706c..61318b7 100644 --- a/vue.config.js +++ b/vue.config.js @@ -28,4 +28,16 @@ module.exports = { css: { loaderOptions: {}, }, + chainWebpack: (config) => { + // config.module.rules.delete("svg"); //重点:删除默认配置中处理svg, + config.module + .rule("svg-sprite-loader") + .test(/\.svg$/) + .end() + .use("svg-sprite-loader") + .loader("svg-sprite-loader") + .options({ + symbolId: "icon-[name]", + }); + }, };