File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed
Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 2121 </div >
2222 </template >
2323 <template #[activePlugin ]=" { tab } " >
24- <h3 class =" text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center space-x-2" >
25- <img :src =" `/icons/${activePlugin.replace(/\d+$/, '')}.svg`" class =" w-6 h-6" :alt =" tab.label" />
26- <span >{{ `语言 [ ${tab.label} ] 配置` }}</span >
27- </h3 >
24+ <div class =" flex items-center justify-between mb-4" >
25+ <h3 class =" text-lg font-semibold text-gray-900 dark:text-white flex items-center space-x-2" >
26+ <img :src =" `/icons/${activePlugin.replace(/\d+$/, '')}.svg`" class =" w-6 h-6" :alt =" tab.label" />
27+ <span >{{ `语言 [ ${tab.label} ] 配置` }}</span >
28+ </h3 >
29+ <div v-if =" isSaving" class =" flex items-center space-x-2 text-sm text-blue-600 dark:text-blue-400" >
30+ <svg class =" animate-spin h-4 w-4" xmlns =" http://www.w3.org/2000/svg" fill =" none" viewBox =" 0 0 24 24" >
31+ <circle class =" opacity-25" cx =" 12" cy =" 12" r =" 10" stroke =" currentColor" stroke-width =" 4" ></circle >
32+ <path class =" opacity-75" fill =" currentColor" d =" M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" ></path >
33+ </svg >
34+ <span >保存中...</span >
35+ </div >
36+ </div >
2837
2938 <Tabs v-model =" activeTab"
3039 type =" card"
@@ -136,6 +145,7 @@ const {
136145 tabsPluginData,
137146 pluginConfig,
138147 pluginEnabledStates,
148+ isSaving,
139149 handleTabChange,
140150 handlePluginToggle,
141151 selectExecuteHome,
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ export function useLanguageSettings(emit: any)
3838 tabsPluginData,
3939 pluginConfig,
4040 globalConfig,
41+ isSaving,
4142 handleTabChange,
4243 selectExecuteHome,
4344 updateGlobalConfig,
@@ -168,6 +169,7 @@ export function useLanguageSettings(emit: any)
168169 tabsPluginData,
169170 pluginConfig,
170171 pluginEnabledStates,
172+ isSaving,
171173 handleTabChange,
172174 handlePluginToggle,
173175 selectExecuteHome,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export function usePluginConfig(emit?: any)
2828 const tabsPluginData = ref < TabData [ ] > ( [ ] )
2929 const globalConfig = ref < any > ( null )
3030 const isInitialLoad = ref ( true )
31+ const isSaving = ref ( false )
3132
3233 const pluginConfig = ref < PluginConfig > ( {
3334 enabled : true ,
@@ -144,6 +145,8 @@ export function usePluginConfig(emit?: any)
144145 }
145146
146147 try {
148+ isSaving . value = true
149+
147150 const pluginIndex = globalConfig . value . plugins . findIndex (
148151 ( plugin : any ) => plugin . language === updatedPlugin . language
149152 )
@@ -179,6 +182,9 @@ export function usePluginConfig(emit?: any)
179182 emit ( 'error' , '保存配置失败' )
180183 }
181184 }
185+ finally {
186+ isSaving . value = false
187+ }
182188 }
183189
184190 // 防抖更新
@@ -269,6 +275,7 @@ export function usePluginConfig(emit?: any)
269275 tabsPluginData,
270276 globalConfig,
271277 pluginConfig,
278+ isSaving,
272279
273280 // 方法
274281 getSupportedLanguages,
You can’t perform that action at this time.
0 commit comments