JSFiddle - React, Tailwind, and code Playground
by skirtle
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.global.js"></script>
<div id="vmodel">
<my-component v-model="count"></my-component>
{{ count }}
</div>
JavaScript
const app = Vue.createApp({
data() {
return {
count: 1
}
}
})
app.mixin({})
app.component('my-component', {
template: `
<div>
<button @click="$emit('update:modelValue', modelValue + 1)">Click</button>
</div>
`,
props: ['modelValue']
})
app.mount('#vmodel')