From 3b90d1f177f265b20af010cd8ba1af80250ddbdc Mon Sep 17 00:00:00 2001 From: ci010 Date: Sun, 17 Nov 2024 15:35:13 +0800 Subject: [PATCH] refactor: Allow to change icon on the context menu --- .../components/AppChangeInstanceIconCard.vue | 10 ++++++--- .../src/composables/instanceContextMenu.ts | 16 ++++++++++++++ .../src/views/BaseSettingGeneral.vue | 22 +++++++++++++++++-- xmcl-keystone-ui/src/views/InstancesCard.vue | 4 ++-- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/xmcl-keystone-ui/src/components/AppChangeInstanceIconCard.vue b/xmcl-keystone-ui/src/components/AppChangeInstanceIconCard.vue index fc586dbc3..a6227bbc2 100644 --- a/xmcl-keystone-ui/src/components/AppChangeInstanceIconCard.vue +++ b/xmcl-keystone-ui/src/components/AppChangeInstanceIconCard.vue @@ -4,6 +4,7 @@ import { useVModel } from '@vueuse/core' const { t } = useI18n() const props = defineProps<{ icon: string + color?: string }>() const emit = defineEmits<{ @@ -33,8 +34,11 @@ function pickIconFile() { - - + @@ -181,6 +183,10 @@ import SettingItemCheckbox from '@/components/SettingItemCheckbox.vue' import { kUserContext } from '@/composables/user' import { AUTHORITY_MICROSOFT } from '@xmcl/runtime-api' import AppChangeInstanceIconCard from '@/components/AppChangeInstanceIconCard.vue' +import { useQuery } from '@/composables/query' +import { useTimeout } from '@vueuse/core' + +const changeIcon = useQuery('changeIcon') const { data, @@ -221,6 +227,18 @@ const { t } = useI18n() const changeIconModel = ref(false) +onMounted(() => { + if (changeIcon.value) { + nextTick().then(() => { + changeIconModel.value = true + start() + }) + } +}) + +const { ready, start } = useTimeout(500, { controls: true }) +const highlighted = computed(() => !ready.value && changeIconModel.value) +