Skip to content

Commit 1d0ac66

Browse files
committed
updated component
1 parent 4997bb3 commit 1d0ac66

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/component.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,19 @@ export default defineComponent({
8383
const unmaskedValue = ref('' as Input | undefined)
8484
const config = computed(() => ({ ...props }))
8585
86+
const emittedValue = computed(() => {
87+
return props.masked ? maskedValue.value : unmaskedValue.value
88+
})
89+
8690
const input = (event: Event) => {
8791
const { target } = event as CustomInputEvent
8892
maskedValue.value = target.value
8993
unmaskedValue.value = target.unmaskedValue
90-
emit('input:model-value', props.masked ? maskedValue.value : unmaskedValue.value)
94+
emit('input:model-value', emittedValue.value)
9195
}
9296
9397
const change = () => {
94-
emit('update:model-value', props.masked ? maskedValue.value : unmaskedValue.value)
98+
emit('update:model-value', emittedValue.value)
9599
}
96100
97101
watch(

0 commit comments

Comments
 (0)