fix(dict): 🐛 移除字典组件的 WebSocket 监听器,以防止在注销登录期间出现无效令牌请求

This commit is contained in:
Ray.Hao
2025-05-09 13:59:15 +08:00
parent e36f5c813f
commit f4f79e5495
2 changed files with 3 additions and 16 deletions

View File

@@ -53,18 +53,14 @@ const updateLabelAndTag = async () => {
tagType.value = newTagType as typeof tagType.value; tagType.value = newTagType as typeof tagType.value;
}; };
watch([() => props.code, () => props.modelValue], updateLabelAndTag); // 初始化或code变化时更新标签和标签样式
onMounted(updateLabelAndTag);
// 监听WebSocket字典更新事件强制刷新标签
watch( watch(
() => dictStore.getDictItems(props.code || ""), [() => props.code, () => props.modelValue],
async () => { async () => {
if (props.code) { if (props.code) {
await updateLabelAndTag(); await updateLabelAndTag();
} }
}, },
{ deep: true } { immediate: true }
); );
</script> </script>

View File

@@ -120,13 +120,4 @@ onMounted(async () => {
await dictStore.loadDictItems(props.code); await dictStore.loadDictItems(props.code);
options.value = dictStore.getDictItems(props.code); options.value = dictStore.getDictItems(props.code);
}); });
// 监听字典数据变化确保WebSocket更新时刷新选项
watch(
() => dictStore.getDictItems(props.code),
(newItems) => {
options.value = newItems;
},
{ deep: true }
);
</script> </script>