From 7b50b28934128ba4028cb250722d90b618170358 Mon Sep 17 00:00:00 2001
From: ZXSheng <952396285@qq.com>
Date: Sun, 17 Apr 2022 19:44:12 +0800
Subject: [PATCH] perf: add a button to save the settings in the actions area
of the theme settings page (#549)
* feature- The Save button in the theme setting page is placed at the top
* perf:The Save button in the theme setting page is placed at the top
* perf: add a button to save the settings in the actions area of the theme settings page
* add icon
---
src/views/dashboard/Dashboard.vue | 6 +++-
src/views/interface/ThemeSetting.vue | 34 ++++++++++++++++++-
.../interface/components/ThemeSettingForm.vue | 7 ++--
3 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue
index 335f7890..6d19b411 100644
--- a/src/views/dashboard/Dashboard.vue
+++ b/src/views/dashboard/Dashboard.vue
@@ -62,7 +62,11 @@
{{ item.title }}
-
+
{{ item.title }}
diff --git a/src/views/interface/ThemeSetting.vue b/src/views/interface/ThemeSetting.vue
index 5b83f843..a7c024c8 100644
--- a/src/views/interface/ThemeSetting.vue
+++ b/src/views/interface/ThemeSetting.vue
@@ -1,6 +1,17 @@
+
@@ -46,7 +57,7 @@
-
+
{
+ this.form.saving = false
+ }, 400)
+ }
+ },
+ handleSaveSettingsCallback() {
+ if (this.form.saveErrored) {
+ this.form.saveErrored = false
+ }
}
}
}
diff --git a/src/views/interface/components/ThemeSettingForm.vue b/src/views/interface/components/ThemeSettingForm.vue
index 6e446e26..37ff0390 100644
--- a/src/views/interface/components/ThemeSettingForm.vue
+++ b/src/views/interface/components/ThemeSettingForm.vue
@@ -187,13 +187,16 @@ export default {
this.$log.error(error)
}
},
- async handleSaveSettings() {
+ async handleSaveSettings(enableLoading = true) {
try {
- this.form.saving = true
+ if (enableLoading) {
+ this.form.saving = true
+ }
await apiClient.theme.saveSettings(this.theme.id, this.form.settings)
} catch (error) {
this.$log.error(error)
this.form.saveErrored = true
+ throw new Error(error)
} finally {
setTimeout(() => {
this.form.saving = false