-
-
Notifications
You must be signed in to change notification settings - Fork 198
Open
Description
// 你的答案
<script setup lang='ts'>
import { ref } from "vue"
/**
* Implement a custom directive
* Create a two-way binding on a form input element
*
*/
const VOhModel = {
handler(){},
mounted(el,binding){
el.value = binding.value
el.oninput = function(){
value.value = el.value
}
},
}
const value = ref("Hello Vue.js")
</script>
<template>
<input v-oh-model="value" type="text" />
<p>{{ value }}</p>
</template>