fix color interface showing black color when empty (#12445)

* fix color interface showing black color when empty

* Default interface value to null

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
Azri Kahar
2022-04-02 01:25:19 +08:00
committed by GitHub
parent 3307bed5fd
commit 8a0fa660bf

View File

@@ -168,7 +168,7 @@ const { t } = useI18n();
interface Props {
disabled?: boolean;
value?: string;
value?: string | null;
placeholder?: string;
presets?: { name: string; color: string }[];
width: string;
@@ -177,7 +177,7 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {
disabled: false,
value: undefined,
value: () => null,
placeholder: undefined,
opacity: false,
presets: () => [
@@ -223,6 +223,7 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits(['input']);
const valueWithoutVariables = computed(() => {
if (!props.value) return null;
return props.value?.startsWith('var(--') ? cssVar(props.value.substring(4, props.value.length - 1)) : props.value;
});