File tree Expand file tree Collapse file tree 18 files changed +584
-1782
lines changed
assets/icons/preserve-color Expand file tree Collapse file tree 18 files changed +584
-1782
lines changed Original file line number Diff line number Diff line change 5050 "typescript" : " 5.6.3" ,
5151 "unocss" : " 0.64.1" ,
5252 "unplugin-auto-import" : " 0.18.6" ,
53+ "unplugin-svg-component" : " 0.10.4" ,
5354 "unplugin-vue-components" : " 0.27.5" ,
5455 "vite" : " 6.0.1" ,
55- "vite-plugin-svg-icons" : " 2.0.1" ,
5656 "vite-svg-loader" : " 5.1.0" ,
5757 "vitest" : " 2.1.6" ,
5858 "vue-tsc" : " 2.1.10"
Original file line number Diff line number Diff line change 1+ ## 目录说明
2+
3+ - ` common/assets/icons/preserve-color ` 目录下存放带颜色的 svg icon
4+
5+ - ` common/assets/icons ` 目录存放的 svg icon 会被插件重写 ` fill ` 和 ` stroke ` 属性,使得图片自带的颜色丢失,从而继承父元素的颜色
6+
7+ ## 使用说明
8+
9+ ` common/assets/icons/preserve-color ` 目录下需要添加 ` preserve-color/ ` 前缀,像这样: ` <SvgIcon name="preserve-color/name" /> `
10+
11+ ` common/assets/icons ` 目录下则不需要,像这样: ` <SvgIcon name="name" /> `
Original file line number Diff line number Diff line change @@ -80,11 +80,11 @@ function handleContentFullClick() {
8080 <div >
8181 <!-- 全屏 -->
8282 <el-tooltip v-if =" !props.content" effect =" dark" :content =" fullscreenTips" placement =" bottom" >
83- <SvgIcon :name =" fullscreenSvgName" @click =" handleFullscreenClick" />
83+ <SvgIcon :name =" fullscreenSvgName" @click =" handleFullscreenClick" class = " svg-icon " />
8484 </el-tooltip >
8585 <!-- 内容区 -->
8686 <el-dropdown v-else :disabled =" isFullscreen" >
87- <SvgIcon :name =" contentLargeSvgName" />
87+ <SvgIcon :name =" contentLargeSvgName" class = " svg-icon " />
8888 <template #dropdown >
8989 <el-dropdown-menu >
9090 <!-- 内容区放大 -->
Original file line number Diff line number Diff line change @@ -14,16 +14,16 @@ const { isMobile } = useDevice()
1414 <div class =" search-footer" >
1515 <template v-if =" ! isMobile " >
1616 <span class =" search-footer-item" >
17- <SvgIcon name =" keyboard-enter" />
17+ <SvgIcon name =" keyboard-enter" class = " svg-icon " />
1818 <span >确认</span >
1919 </span >
2020 <span class =" search-footer-item" >
21- <SvgIcon name =" keyboard-up" />
22- <SvgIcon name =" keyboard-down" />
21+ <SvgIcon name =" keyboard-up" class = " svg-icon " />
22+ <SvgIcon name =" keyboard-down" class = " svg-icon " />
2323 <span >切换</span >
2424 </span >
2525 <span class =" search-footer-item" >
26- <SvgIcon name =" keyboard-esc" />
26+ <SvgIcon name =" keyboard-esc" class = " svg-icon " />
2727 <span >关闭</span >
2828 </span >
2929 </template >
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ function handleReleaseUpOrDown() {
155155 >
156156 <el-input ref =" inputRef" v-model =" keyword" placeholder =" 搜索菜单" size =" large" clearable @input =" handleSearch" >
157157 <template #prefix >
158- <SvgIcon name =" search" />
158+ <SvgIcon name =" search" class = " svg-icon " />
159159 </template >
160160 </el-input >
161161 <el-empty v-if =" result.length === 0" description =" 暂无搜索结果" :image-size =" 100" />
Original file line number Diff line number Diff line change @@ -76,12 +76,12 @@ defineExpose({ getScrollTop })
7676 :style =" itemStyle(item)"
7777 @mouseenter =" handleMouseenter(item)"
7878 >
79- <SvgIcon v-if =" item.meta?.svgIcon" :name =" item.meta.svgIcon" />
79+ <SvgIcon v-if =" item.meta?.svgIcon" :name =" item.meta.svgIcon" class = " svg-icon " />
8080 <component v-else-if =" item.meta?.elIcon" :is =" item.meta.elIcon" class =" el-icon" />
8181 <span class =" result-item-title" >
8282 {{ item.meta?.title }}
8383 </span >
84- <SvgIcon v-if =" modelValue && modelValue === item.name" name =" keyboard-enter" />
84+ <SvgIcon v-if =" modelValue && modelValue === item.name" name =" keyboard-enter" class = " svg-icon " />
8585 </div >
8686 </div >
8787</template >
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ function handleOpen() {
1313<template >
1414 <div >
1515 <el-tooltip effect =" dark" content =" 搜索菜单" placement =" bottom" >
16- <SvgIcon name =" search" @click =" handleOpen" />
16+ <SvgIcon name =" search" @click =" handleOpen" class = " svg-icon " />
1717 </el-tooltip >
1818 <Modal v-model =" visible" />
1919 </div >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ function resolvePath(routePath: string) {
5252 <template v-if =" ! alwaysShowRootMenu && theOnlyOneChild && ! theOnlyOneChild .children " >
5353 <Link v-if =" theOnlyOneChild.meta" :to =" resolvePath(theOnlyOneChild.path)" >
5454 <el-menu-item :index =" resolvePath(theOnlyOneChild.path)" >
55- <SvgIcon v-if =" theOnlyOneChild.meta.svgIcon" :name =" theOnlyOneChild.meta.svgIcon" />
55+ <SvgIcon v-if =" theOnlyOneChild.meta.svgIcon" :name =" theOnlyOneChild.meta.svgIcon" class = " svg-icon " />
5656 <component v-else-if =" theOnlyOneChild.meta.elIcon" :is =" theOnlyOneChild.meta.elIcon" class =" el-icon" />
5757 <template v-if =" theOnlyOneChild .meta .title " #title >
5858 <span class =" title" >{{ theOnlyOneChild.meta.title }}</span >
@@ -62,7 +62,7 @@ function resolvePath(routePath: string) {
6262 </template >
6363 <el-sub-menu v-else :index =" resolvePath(props.item.path)" teleported >
6464 <template #title >
65- <SvgIcon v-if =" props.item.meta?.svgIcon" :name =" props.item.meta.svgIcon" />
65+ <SvgIcon v-if =" props.item.meta?.svgIcon" :name =" props.item.meta.svgIcon" class = " svg-icon " />
6666 <component v-else-if =" props.item.meta?.elIcon" :is =" props.item.meta.elIcon" class =" el-icon" />
6767 <span v-if =" props.item.meta?.title" class =" title" >{{ props.item.meta.title }}</span >
6868 </template >
You can’t perform that action at this time.
0 commit comments