From 494a54d330ecd1e9fb0b868a90c373822dda2509 Mon Sep 17 00:00:00 2001 From: zyh Date: Thu, 16 Jun 2022 17:54:08 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-1941=20fix=EF=BC=9A=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E9=80=89=E6=8B=A9=E5=99=A8tab=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/js/tools.js | 21 ++++++++---------- .../src/components/common/nezhaColor.vue | 22 +++++++------------ 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index a430a8312..6d0b864a0 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -39,18 +39,15 @@ export const clickoutside = { if (oldValue) { // const newValue = JSON.parse(JSON.stringify(binding.value.obj)) if (unsavedChange == 'on' && !isEqual(oldValue, el.__newValue__)) { - // 防止表单自动聚焦 - setTimeout(() => { - MessageBox.confirm(i18n.t('tip.confirmCancel'), { - confirmButtonText: i18n.t('tip.yes'), - cancelButtonText: i18n.t('tip.no'), - type: 'warning' - }).then(() => { - if (binding.value.func) { - binding.value.func() - } - }).catch(err => err) - }) + MessageBox.confirm(i18n.t('tip.confirmCancel'), { + confirmButtonText: i18n.t('tip.yes'), + cancelButtonText: i18n.t('tip.no'), + type: 'warning' + }).then(() => { + if (binding.value.func) { + binding.value.func() + } + }).catch(err => err) } else { binding.value.func() } diff --git a/nezha-fronted/src/components/common/nezhaColor.vue b/nezha-fronted/src/components/common/nezhaColor.vue index 9266e5aa9..420997fdf 100644 --- a/nezha-fronted/src/components/common/nezhaColor.vue +++ b/nezha-fronted/src/components/common/nezhaColor.vue @@ -82,18 +82,7 @@ export default { } }, watch: { - valueArr: { - handler (n) { - if (!this.isTopo) { - this.keyName = this.valueArr[0].name - this.colors = this.valueArr[0].value || randomcolor() + 'FF' - } else { - this.keyName = this.valueArr[0].name - this.colors = this.valueArr[0].value - } - }, - deep: true - } + }, data () { return { @@ -156,8 +145,13 @@ export default { // }, colorTabChange (item) { - this.keyName = item.name - this.colors = this.colorVal[item.name] || randomcolor() + 'FF' + if (!this.isTopo) { + this.keyName = item.name + this.colors = this.colorVal[item.name] || randomcolor() + 'FF' + } else { + this.keyName = item.name + this.colors = this.colorVal[item.name] + } }, exitColor () { this.showColorPicker = false