Update dependencies and fix code issues
This commit is contained in:
@@ -14,17 +14,21 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
defaultValue: {
|
||||
value: {
|
||||
type: String,
|
||||
default: '1 Menit'
|
||||
}
|
||||
|
||||
})
|
||||
const emit = defineEmits(['update:menitValue'])
|
||||
const menitValue = ref(props.defaultValue)
|
||||
watch(menitValue, (newValue) => {
|
||||
emit('update:menitValue', newValue)
|
||||
})
|
||||
const handleInput = (e :any) => {
|
||||
e.value = e.value.replace(/[^0-9.]/g, '')
|
||||
}
|
||||
const handleBlur = (e :any) => {
|
||||
e.value = e.value ? e.value + ' Menit' : ''
|
||||
}
|
||||
const handleFocus = (e:any) => {
|
||||
e.value = e.value.replace(/[^0-9.]/g, '')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -32,7 +36,7 @@ watch(menitValue, (newValue) => {
|
||||
|
||||
class="relative w-full overflow-hidden rounded-lg bg-gray-200">
|
||||
<input
|
||||
v-model="menitValue"
|
||||
:value="props.value"
|
||||
autocomplete="off"
|
||||
type="text"
|
||||
:placeholder="placeholder"
|
||||
@@ -40,12 +44,10 @@ watch(menitValue, (newValue) => {
|
||||
inputmode="numeric"
|
||||
pattern="[0-9.]*"
|
||||
:disabled="disabled"
|
||||
:defaultValue="props.defaultValue"
|
||||
oninput="this.value = this.value.replace(/[^0-9.]/g, '')"
|
||||
onblur="this.value = this.value ? this.value + ' Menit' : ''"
|
||||
onfocus="this.value = this.value.replace(/[^0-9.]/g, '')"
|
||||
class="w-full px-4 py-2 text-sm leading-6 placeholder:text-gray-400 text-gray-900 border-0 border-transparent rounded-lg outline-0 bg-gray-200 focus:outline-0 focus:border-0 focus:ring-0
|
||||
"
|
||||
@oninput="handleInput($event)"
|
||||
@onblur="handleBlur($event)"
|
||||
@onfocus="handleFocus($event)"
|
||||
class="w-full px-4 py-2 text-sm leading-6 placeholder:text-gray-400 text-gray-900 border-0 border-transparent rounded-lg outline-0 bg-gray-200 focus:outline-0 focus:border-0 focus:ring-0"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user