vue toggle做一个点击切换class(实例讲解)
下面小编就为大家分享一篇使用vue toggle实现点击切换class的示例。具有很好的参考价值。希望对大家有所帮助。一起跟随小编过来看看吧
div
span :class="{'bg-primary text-danger':isA,'ess text-white':!isA}" @click="toggle()" AAAAA /span
/div
/template
script
export default {
name: 'hello',
data () {
return {
isA: false
methods:{
toggle:function () {
this.isA=!this.isA
/script
style scoped
@import "../../../src/assets/plugin/bootstrap-4.0.0-alpha.6-dist/css/bootstrap.css";
/style
以上这篇vue toggle做一个点击切换class(实例讲解)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持凡科。