From a21a1ca533ddf739fbcb52388e76141ea7d9b8ad Mon Sep 17 00:00:00 2001 From: clddup <105873086+clddup@users.noreply.github.com> Date: Sun, 5 Jan 2025 16:54:32 +0800 Subject: [PATCH] docs: theme editor --- .../antdv-token-previewer/ColorPanel.tsx | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/site/src/components/antdv-token-previewer/ColorPanel.tsx b/site/src/components/antdv-token-previewer/ColorPanel.tsx index aa7e3fc923..b341ee99f0 100644 --- a/site/src/components/antdv-token-previewer/ColorPanel.tsx +++ b/site/src/components/antdv-token-previewer/ColorPanel.tsx @@ -2,10 +2,11 @@ import type { InputProps } from 'ant-design-vue'; import { ConfigProvider, Input, InputNumber, Select, theme } from 'ant-design-vue'; import classNames from 'ant-design-vue/es/_util/classNames'; import type { PropType } from 'vue'; -import { defineComponent, watchEffect, watch, computed, toRefs, ref } from 'vue'; +import { defineComponent, watchEffect, computed, toRefs, ref } from 'vue'; import { HexColorPicker, RgbaColorPicker } from '../vue-colorful'; import tinycolor from 'tinycolor2'; import makeStyle from './utils/makeStyle'; +import type { ValueType } from 'ant-design-vue/es/input-number/src/utils/MiniDecimal'; const { useToken } = theme; @@ -168,24 +169,42 @@ const RgbColorInput = defineComponent({ setup(props) { const { value, alpha } = toRefs(props); - watch(value, val => { - props.onChange(val); - }); - + const handleChange = (val: ValueType, key: 'r' | 'g' | 'b' | 'a') => { + value.value[key] = val; + props.onChange(value.value); + }; return () => { return (