<ul>
<li v-on:click="chooseTab" v-bind:class="{active: chooseTab ==""}"><a href="javascript:;"></a></li>
<li v-on:click="chooseTab" v-bind:class="{active: chooseTab ==""}"><a href="javascript:;"></a></li>
<li v-on:click="chooseTab" v-bind:class="{active: chooseTab ==""}"><a href="javascript:;"></a></li>
<li v-on:click="chooseTab" v-bind:class="{active: chooseTab ==""}"><a href="javascript:;"></a></li>
</ul>
var app = new Vue({
el: "-sharpvue-app",
data: {
chooseTab: ""
},
methods: {
chooseTab: function(event) {
var el = event.currentTarget;
this.chooseTab = el.innerText;
}
}
})
Click the first time to work, and click the second time to report an error
Thank you for your answer, thank you.