<body>
<div id="root"></div>
<script>
Vue.createApp({
data(){
return {
show: true,
content: 'hello world'
}
},
methods: {
handleBtnClick(){
this.show = !this.show
}
},
template: `
<div>
<span v-if='show'>{{ content }}</span>
<button v-on:click='handleBtnClick'>展示或者隐藏</button>
</div>
`
}).mount('#root')
</script>
</body>