Skip to content

Commit 076c597

Browse files
s3d-iwhyXVI
andauthored
fix(ui): align ColorHueRange model binding (#681)
Co-authored-by: whyXVI <lain_zcb@bupt.edu.cn>
1 parent 4536ea6 commit 076c597

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

packages/ui/src/components/Form/Range/ColorHueRange.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
<script setup lang="ts">
2+
import { computed } from 'vue'
3+
24
const props = defineProps<{
35
disabled?: boolean
46
class?: string
57
}>()
68
7-
const colorValue = defineModel<string>('colorValue', {
8-
type: String,
9-
default: '',
9+
const modelValue = defineModel<number>({ required: true })
10+
11+
const sliderValue = computed({
12+
get: () => modelValue.value,
13+
set: (value: number) => {
14+
if (Number.isNaN(value))
15+
return
16+
17+
modelValue.value = value
18+
},
1019
})
1120
</script>
1221

1322
<template>
1423
<input
15-
v-model="colorValue"
24+
v-model.number="sliderValue"
1625
type="range" min="0" max="360" step="0.01"
1726
class="color-hue-range"
1827
transition="all ease-in-out duration-250"

0 commit comments

Comments
 (0)