From 9a527af0149970aeeb8d5fce0bc6a3cf851bba93 Mon Sep 17 00:00:00 2001 From: natural1024 Date: Mon, 6 Jan 2025 19:11:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(color-picker):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=A8=A1=E5=BC=8F=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=98=BE=E7=A4=BA=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closed #4861 --- src/color-picker/panel/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/color-picker/panel/index.tsx b/src/color-picker/panel/index.tsx index 0e8a2d93ca..03476a6627 100644 --- a/src/color-picker/panel/index.tsx +++ b/src/color-picker/panel/index.tsx @@ -41,7 +41,13 @@ export default defineComponent({ const defaultEmptyColor = computed(() => (isGradient.value ? DEFAULT_LINEAR_GRADIENT : DEFAULT_COLOR)); - const mode = ref(props.colorModes?.length === 1 ? props.colorModes[0] : 'monochrome'); + const mode = ref( + props.colorModes?.length !== 1 && innerValue.value?.includes('linear-gradient') + ? 'linear-gradient' + : props.colorModes?.length === 1 + ? props.colorModes[0] + : 'monochrome', + ); const isGradient = computed(() => mode.value === 'linear-gradient'); const color = ref(new Color(innerValue.value || defaultEmptyColor.value));