Skip to content

Commit afd90b1

Browse files
committed
fix: 修复打开语言配置自动保存问题
1 parent 0d49717 commit afd90b1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/composables/usePluginConfig.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export function usePluginConfig(emit?: any)
2727
const activeTab = ref('general')
2828
const tabsPluginData = ref<TabData[]>([])
2929
const globalConfig = ref<any>(null)
30+
const isInitialLoad = ref(true)
3031

3132
const pluginConfig = ref<PluginConfig>({
3233
enabled: true,
@@ -82,6 +83,8 @@ export function usePluginConfig(emit?: any)
8283
// 处理标签页切换
8384
const handleTabChange = () => {
8485
if (globalConfig.value && globalConfig.value.plugins && activePlugin.value) {
86+
isInitialLoad.value = true
87+
8588
const foundPlugin = globalConfig.value.plugins.find(
8689
(plugin: any) => plugin.language === activePlugin.value
8790
)
@@ -104,6 +107,10 @@ export function usePluginConfig(emit?: any)
104107
timeout: 30
105108
}
106109
}
110+
111+
setTimeout(() => {
112+
isInitialLoad.value = false
113+
}, 100)
107114
}
108115
}
109116

@@ -238,7 +245,7 @@ export function usePluginConfig(emit?: any)
238245

239246
// 监听插件配置变化
240247
watch(pluginConfig, (newConfig, oldConfig) => {
241-
if (oldConfig && newConfig.language) {
248+
if (!isInitialLoad.value && oldConfig && newConfig.language) {
242249
console.log('插件配置变化:', oldConfig, '->', newConfig)
243250
debouncedUpdate(newConfig)
244251
}

0 commit comments

Comments
 (0)