JSFiddle - React, Tailwind, and code Playground
by imall
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.global.js"></script>
<div id="app">
<my-component v-model="message"></my-component>
{{ message }}
</div>
JavaScript
const app = Vue.createApp({
setup() {
const message = Vue.ref("hello");
return {
message
};
},
});
app.component("my-component", {
template: `
<input :value="modelValue"
@input="$emit('update:modelValue', $event.target.value)"
/>
`,
props: ["modelValue"],
emits: ["update:modelValue"],
});
app.mount("#app");