From 63eb855e4ff75172570744ae5d81914f4ef72f9d Mon Sep 17 00:00:00 2001 From: ulleo Date: Tue, 2 Jul 2024 17:10:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=A0=B7=E5=BC=8F=E9=80=8F=E6=98=8E=E5=BA=A6?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E6=97=A0=E6=B3=95=E9=99=90=E5=88=B6?= =?UTF-8?q?0-100=E6=95=B4=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/BasicStyleSelector.vue | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue index 6b39db4dad..f959c70bd6 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue @@ -57,6 +57,22 @@ const emit = defineEmits(['onBasicStyleChange', 'onMiscChange']) const changeBasicStyle = (prop?: string, requestData = false) => { emit('onBasicStyleChange', { data: state.basicStyleForm, requestData }, prop) } +const onAlphaChange = v => { + const _v = parseInt(v) + if (_v >= 0 && _v <= 100) { + state.basicStyleForm.alpha = _v + } else if (_v < 0) { + state.basicStyleForm.alpha = 0 + } else if (_v > 100) { + state.basicStyleForm.alpha = 100 + } else { + const basicStyle = cloneDeep(props.chart.customAttr.basicStyle) + const oldForm = defaultsDeep(basicStyle, cloneDeep(DEFAULT_BASIC_STYLE)) as ChartBasicStyle + state.basicStyleForm.alpha = oldForm.alpha + } + changeBasicStyle('alpha') +} + const changeMisc = prop => { emit('onMiscChange', { data: state.miscForm, requestData: true }, prop) } @@ -275,7 +291,7 @@ onMounted(() => { :max="100" class="basic-input-number" :controls="false" - @change="changeBasicStyle('alpha')" + @change="onAlphaChange" > @@ -521,7 +537,7 @@ onMounted(() => { :max="100" class="basic-input-number" :controls="false" - @change="changeBasicStyle('alpha')" + @change="onAlphaChange" >