变更
This commit is contained in:
@@ -132,7 +132,10 @@ const _sfc_main = defineComponent({
|
||||
alpha.value = a;
|
||||
});
|
||||
watch([red, green, blue], (newValue) => {
|
||||
emit("update:modelValue", rgba2hex(red.value, green.value, blue.value, alpha.value));
|
||||
emit(
|
||||
"update:modelValue",
|
||||
rgba2hex(red.value, green.value, blue.value, alpha.value)
|
||||
);
|
||||
let { h, s, v } = rgb2hsv(red.value, green.value, blue.value);
|
||||
hue.value = h;
|
||||
saturation.value = s;
|
||||
@@ -141,7 +144,10 @@ const _sfc_main = defineComponent({
|
||||
hueSliderStyle.value = `left: ${hue.value / 360 * 100}%;`;
|
||||
});
|
||||
watch(alpha, () => {
|
||||
emit("update:modelValue", rgba2hex(red.value, green.value, blue.value, alpha.value));
|
||||
emit(
|
||||
"update:modelValue",
|
||||
rgba2hex(red.value, green.value, blue.value, alpha.value)
|
||||
);
|
||||
alphaSliderStyle.value = `left: ${alpha.value >= 1 ? "calc(100% - 6px)" : alpha.value * 100 + "%"};`;
|
||||
});
|
||||
let colorObj = computed(() => {
|
||||
@@ -278,7 +284,9 @@ const _sfc_main = defineComponent({
|
||||
if (color) {
|
||||
let r, g, b, a;
|
||||
if (typeof color === "string") {
|
||||
if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8}|[0-9a-fA-F]{3}|[0-9a-fA-F]{4})$/.test(color)) {
|
||||
if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8}|[0-9a-fA-F]{3}|[0-9a-fA-F]{4})$/.test(
|
||||
color
|
||||
)) {
|
||||
return hex2rgba(color);
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user