Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-21 11:29:20 +08:00

refactor: 更改 svg icons 目录结构

This commit is contained in:
pany 2024-11-22 16:06:31 +08:00
parent 17b9ebb55c
commit 23f5dc9c14
21 changed files with 8 additions and 9 deletions

View File

Before

Width:  |  Height:  |  Size: 548 B

After

Width:  |  Height:  |  Size: 548 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 522 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 747 B

After

Width:  |  Height:  |  Size: 747 B

View File

Before

Width:  |  Height:  |  Size: 746 B

After

Width:  |  Height:  |  Size: 746 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 241 B

After

Width:  |  Height:  |  Size: 241 B

View File

Before

Width:  |  Height:  |  Size: 694 B

After

Width:  |  Height:  |  Size: 694 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 925 B

After

Width:  |  Height:  |  Size: 925 B

View File

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 613 B

View File

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 539 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 775 B

After

Width:  |  Height:  |  Size: 775 B

View File

@ -5,7 +5,6 @@ import { router } from "@/router"
import { createApp } from "vue"
import "@/router/permission"
// load
import { loadSvg } from "@/assets/icons"
import { loadDirectives } from "@/directives"
import { loadPlugins } from "@/plugins"
// css
@ -21,8 +20,6 @@ const app = createApp(App)
// 加载插件
loadPlugins(app)
// 加载全局 SVG
loadSvg(app)
// 加载自定义指令
loadDirectives(app)

View File

@ -1,7 +1,7 @@
import type { App } from "vue"
import * as ElementPlusIconsVue from "@element-plus/icons-vue"
export function loadElementPlusIcon(app: App) {
export function loadElementPlusIcons(app: App) {
// 注册所有 Element Plus Icon
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)

View File

@ -1,10 +1,12 @@
import type { App } from "vue"
import { loadElementPlus } from "./element-plus"
import { loadElementPlusIcon } from "./element-plus-icon"
import { loadElementPlusIcons } from "./element-plus-icons"
import { loadSvgIcons } from "./svg-icons"
import { loadVxeTable } from "./vxe-table"
export function loadPlugins(app: App) {
loadElementPlus(app)
loadElementPlusIcon(app)
loadElementPlusIcons(app)
loadVxeTable(app)
loadSvgIcons(app)
}

View File

@ -2,6 +2,6 @@ import type { App } from "vue"
import SvgIcon from "@/components/SvgIcon/index.vue" // Svg Component
import "virtual:svg-icons-register"
export function loadSvg(app: App) {
export function loadSvgIcons(app: App) {
app.component("SvgIcon", SvgIcon)
}

View File

@ -9,7 +9,7 @@ declare module "vue-router" {
*/
title?: string
/**
* svg @/assets/icons/svg
* svg @/assets/icons
*/
svgIcon?: string
/**

View File

@ -91,7 +91,7 @@ export default defineConfig(({ mode }) => {
svgLoader({ defaultImport: "url" }),
// 生成 SVG 雪碧图
createSvgIconsPlugin({
iconDirs: [resolve(root, "src/assets/icons/svg")],
iconDirs: [resolve(root, "src/assets/icons")],
symbolId: "icon-[dir]-[name]"
}),
// 原子化 CSS