瀏覽代碼

fix: 修复 菜单管理 Icon 初始化

lanceJiang 1 年之前
父節點
當前提交
8973d7b84c

+ 2 - 5
src/components/IconPicker/PickerIcon.vue

@@ -39,9 +39,9 @@ const colorStyle = computed(() => {
 
 <template>
 	<template v-if="icon.type === 'element'">
-		<component :is="icon.component" class="le-pick-icon menu-icon" :style="colorStyle" />
+		<component :is="icon.component" class="le-pick-icon" :style="colorStyle" />
 	</template>
-	<LeIcon v-else :icon-class="icon.component" class="le-pick-icon menu-icon" :color="color" />
+	<LeIcon v-else :icon-class="icon.component" class="le-pick-icon" :color="color" />
 </template>
 
 <style scoped lang="scss">
@@ -54,8 +54,5 @@ const colorStyle = computed(() => {
 	&:focus {
 		outline: unset;
 	}
-}
-.menu-icon {
-
 }
 </style>

+ 5 - 8
src/components/IconPicker/index.vue

@@ -36,11 +36,11 @@
 </template>
 
 <script setup lang="ts">
-import PickerIcon from '@/components/IconPicker/PickerIcon.vue'
+import PickerIcon from './PickerIcon.vue'
 // import svgIcons from 'virtual:svg-icons-names'
 import { iconTypeOptions } from './iconsData.ts'
 import { useDebounceFn } from '@vueuse/core'
-import { ref, watch, computed } from 'vue'
+import { ref, watch, watchEffect, computed } from 'vue'
 const props = defineProps({
 	modelValue: {
 		type: String,
@@ -104,12 +104,9 @@ watch(visible, (bool: boolean) => {
 		update_currentList()
 	}
 })
-watch(
-	() => props.modelValue,
-	(val: string) => {
-		currentSelect.value = val
-	}
-)
+watchEffect(() => {
+	currentSelect.value = props.modelValue
+})
 const searchValue = ref('')
 const update_currentList = () => {
 	if (searchValue.value) {

+ 1 - 1
src/layout/components/Header/components/Breadcrumb.vue

@@ -27,7 +27,7 @@ import { ArrowRight } from '@element-plus/icons-vue'
 import useStore from '@/store'
 // import router from '@/router'
 import { generateTitle } from '@/utils/i18n'
-import PickerIcon from '@/layout/components/Menu/PickerIcon.vue'
+import PickerIcon from '@/components/IconPicker/PickerIcon.vue'
 
 const route = useRoute()
 const router = useRouter()