保存进度!

This commit is contained in:
Kane 2023-01-07 15:03:51 +08:00
parent 82edc407db
commit b4029677cf
3 changed files with 47 additions and 17 deletions

View File

@ -2,21 +2,21 @@
* @Author: Kane
* @Date: 2023-01-06 20:49:04
* @LastEditors: Kane
* @LastEditTime: 2023-01-06 20:58:42
* @LastEditTime: 2023-01-07 12:17:28
* @FilePath: \admin_system\src\components\svg\svg.js
* @Description: 导入svg图标
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
const svgContext = require.context("./icons", true, /\.svg$/);
console.log(svgContext);
const context = require.context("./icons", false, /\.svg$/);
console.log(context);
function requireAll(context)
{
return context.keys().map(context);
}
const svgMap = requireAll(svgContext);
const svgMap = requireAll(context);
console.log("导入svg");
console.log(svgMap);

View File

@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2022-12-14 15:12:46
* @LastEditors: Kane
* @LastEditTime: 2023-01-07 11:23:18
* @LastEditTime: 2023-01-07 15:03:29
* @FilePath: \admin_system\src\main.js
* @Description:
*
@ -12,7 +12,7 @@ import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import "@/components/svg/svg";
//import "@/components/svg/svg";
import("./css/root.css");
import("./css/normalize.css");

View File

@ -2,20 +2,50 @@
* @Author: Kane
* @Date: 2022-12-17 11:08:18
* @LastEditors: Kane
* @LastEditTime: 2023-01-07 11:12:20
* @LastEditTime: 2023-01-07 12:08:14
* @FilePath: \admin_system\vue.config.js
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
const { defineConfig } = require('@vue/cli-service');
module.exports = defineConfig(
{
// const { defineConfig } = require('@vue/cli-service');
// module.exports = defineConfig(
// {
// transpileDependencies: true,
// devServer: {
// open: true,
// host: "localhost",
// port: 8000,
// },
// }
// );
module.exports = {
transpileDependencies: true,
devServer: {
open: true,
host: "localhost",
port: 8000,
},
}
);
chainWebpack: (config) =>
{
// svg 图标解析
const svgRule = config.module.rule("svg"); //默认规则赋给 subRule 变量
svgRule.uses.clear(); // 清除已有的所有规则。
svgRule // 添加要替换的规则
.use("svg-sprite-loader")
.loader("svg-sprite-loader")
.options({
symbolId: "icon-[name]",
include: ["./src/components/svg/icons"] // 特别注意的目录路径
});
// 配置base64转换规则
// config.module
// .rule('images')
// .use('url-loader')
// .loader('url-loader')
// .tap(options => Object.assign(options, { limit: 1 }));
// 载入项目分析工具
// config.plugin('webpack-bundle-analyzer').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
},
};