JSFiddle - React, Tailwind, and code Playground
by skirtle
HTML
<script src="https://unpkg.com/[email protected]/dist/vue.global.js"></script>
<div id="app">
<span v-if="toggle" ref="ref1">Span</span>
<button @click="toggle = !toggle">Toggle</button>
</div>
JavaScript
const app = Vue.createApp({
data () {
return {
toggle: false
}
},
updated () {
console.log('updated')
console.log(type(this.$refs.ref1))
},
watch: {
toggle: {
// flush: 'post',
handler () {
console.log('watch')
console.log(type(this.$refs.ref1))
}
}
}
})
app.mount('#app')
function type (v) {
return ({}).toString.call(v).slice(8, -1)
}