I am a beginner in Vue. When I was reading about v-once today, I used the button to bind a data.
after clicking the button, the data bound by v-once has not changed, but the button book has not changed either. I bound a new button. Click this new button, and the data of the previous button changes
related codes
/ / Please paste the code text below (do not replace the code with pictures)
<div id="app2">
<!-- text -->
<button @click="change">{{text}}</button>
<p v-once>{{text}}
{{text}}
<!-- {{text}} -->
<button @click="change"></button>
</div>
<script src="https://cdn.bootcss.com/vue/2.5.16/vue.js"></script>
<script>
new Vue({
el:"-sharpapp2",
data:{
text:""
},
methods:{
change:function(){
this.text="";
}
}
})
</script>
what result do you expect? What is the error message actually seen?
I thought that only the data bound by v-once would not change after clicking the test button, and the rest would change.
but after clicking, I found that the test button has not changed, because I am a beginner, do not understand, hope to get the guidance of the god, thank you