Skip to content

Commit

Permalink
fix(color-picker): 修复默认模式第一次打开显示出错 (#4903)
Browse files Browse the repository at this point in the history
closed #4861

Co-authored-by: natural1024 <[email protected]>
  • Loading branch information
natural1024 and natural1024 authored Jan 20, 2025
1 parent d5a048a commit c6b200c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/color-picker/panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ export default defineComponent({

const defaultEmptyColor = computed(() => (isGradient.value ? DEFAULT_LINEAR_GRADIENT : DEFAULT_COLOR));

const mode = ref<TdColorModes>(props.colorModes?.length === 1 ? props.colorModes[0] : 'monochrome');
const mode = ref<TdColorModes>(
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));
Expand Down

0 comments on commit c6b200c

Please sign in to comment.