|
@@ -10,7 +10,9 @@
|
|
|
@click="openDialog"
|
|
|
>
|
|
|
<template #append>
|
|
|
- <el-button :icon="customIcons[iconValue] || ''" />
|
|
|
+ <el-button>
|
|
|
+ <svg-icon v-if="iconValue" :name="iconValue" />
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-input>
|
|
|
<el-dialog v-model="dialogVisible" :title="placeholder" top="10%" width="40%">
|
|
@@ -18,7 +20,11 @@
|
|
|
<el-scrollbar v-if="Object.keys(iconsList).length">
|
|
|
<div class="icon-list">
|
|
|
<div v-for="item in iconsList" :key="item" class="icon-item" @click="selectIcon(item)">
|
|
|
- <component :is="item"></component>
|
|
|
+ <svg-icon v-if="item.name" :name="item.name" />
|
|
|
+ <span>{{ item.name }}</span>
|
|
|
+ </div>
|
|
|
+ <div v-for="item in myIcons" :key="item" class="icon-item" @click="selectIcon(item)">
|
|
|
+ <svg-icon v-if="item.name" :name="item.name" />
|
|
|
<span>{{ item.name }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -30,7 +36,7 @@
|
|
|
|
|
|
<script setup lang="ts" name="SelectIcon">
|
|
|
import * as Icons from '@element-plus/icons-vue'
|
|
|
-
|
|
|
+import myIcons from './customIcons'
|
|
|
interface SelectIconProps {
|
|
|
iconValue: string
|
|
|
title?: string
|
|
@@ -80,6 +86,11 @@ const iconsList = computed((): { [key: string]: any } => {
|
|
|
for (const key in customIcons) {
|
|
|
if (key.toLowerCase().indexOf(inputValue.value.toLowerCase()) > -1) result[key] = customIcons[key]
|
|
|
}
|
|
|
+ if (Object.keys(result).length == 0) {
|
|
|
+ for (const item in myIcons) {
|
|
|
+ if (item.toLowerCase().indexOf(inputValue.value.toLowerCase()) > -1) result[item] = { name: item }
|
|
|
+ }
|
|
|
+ }
|
|
|
return result
|
|
|
})
|
|
|
</script>
|