JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/vue@next"></script>
<div id="app">
<button @click="$counter.increment()" type="button">
{{ $counter.value }}
</button>
</div>
JavaScript
const app = Vue.createApp({
mounted() {
console.log({ counter: this.$counter });
},
});
app.use({
install(app) {
const counter = Vue.ref(1)
app.config.globalProperties.$counter = {
value: counter,
increment() { counter.value++ }
};
}
})
app.mount('#app');