Browse Source

fix: icon选择优化

wanggaokun 1 year ago
parent
commit
c1b219076f

+ 1 - 10
src/components/SelectIcon/index.vue

@@ -23,10 +23,6 @@
             <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>
       </el-scrollbar>
       <el-empty v-else description="未搜索到您要找的图标~" />
@@ -79,18 +75,13 @@ const clearIcon = () => {
 
 // 监听搜索框值
 const inputValue = ref('')
-const customIcons: { [key: string]: any } = Icons
+const customIcons: { [key: string]: any } = Object.assign({}, Icons, myIcons)
 const iconsList = computed((): { [key: string]: any } => {
   if (!inputValue.value) return Icons
   let result: { [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>

+ 0 - 1
src/layouts/components/Header/components/Avatar.vue

@@ -31,7 +31,6 @@ import PasswordDialog from './PasswordDialog.vue'
 import IEDrawer from '@/views/import-export/index.vue'
 const router = useRouter()
 const userStore = useUserStore()
-console.log('userStore', userStore.avatar)
 
 const toProfile = () => {
   router.push('/system/user/profile')