Open
Description
<script setup lang='ts'>
import { ref } from "vue"
const handler = (event: Event) => {
value.value = event.target.value
}
const VOhModel = {
mounted(el: HTMLInputElement, { value }: { value: string }) {
el.value = value
el.addEventListener('input', handler)
},
unmounted(el) {
el.removeEventListener('input', handler)
}
}
const value = ref("Hello Vue.js")
</script>
<template>
<input v-oh-model="value" type="text" />
<p>{{ value }}</p>
</template>