fix(dict): 🐛 移除字典组件的 WebSocket 监听器,以防止在注销登录期间出现无效令牌请求
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user