From d734bfc34f65b6cd036b5f21b718294152fecacf Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期四, 17 二月 2022 11:56:11 +0800 Subject: [PATCH] 修复分页组件请求两次问题(I4SQOR) --- ruoyi-ui/src/components/ThemePicker/index.vue | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ruoyi-ui/src/components/ThemePicker/index.vue b/ruoyi-ui/src/components/ThemePicker/index.vue index 5c16ee4..4ba9bd2 100644 --- a/ruoyi-ui/src/components/ThemePicker/index.vue +++ b/ruoyi-ui/src/components/ThemePicker/index.vue @@ -31,18 +31,21 @@ immediate: true }, async theme(val) { + await this.setTheme(val) + } + }, + created() { + if(this.defaultTheme !== ORIGINAL_THEME) { + this.setTheme(this.defaultTheme) + } + }, + + methods: { + async setTheme(val) { const oldVal = this.chalk ? this.theme : ORIGINAL_THEME if (typeof val !== 'string') return const themeCluster = this.getThemeCluster(val.replace('#', '')) const originalCluster = this.getThemeCluster(oldVal.replace('#', '')) - - const $message = this.$message({ - message: ' Compiling the theme', - customClass: 'theme-message', - type: 'success', - duration: 0, - iconClass: 'el-icon-loading' - }) const getHandler = (variable, id) => { return () => { @@ -80,12 +83,8 @@ }) this.$emit('change', val) + }, - $message.close() - } - }, - - methods: { updateStyle(style, oldCluster, newCluster) { let newStyle = style oldCluster.forEach((color, index) => { -- Gitblit v1.9.2