gogogo
管理员
管理员
  • UID25
  • 粉丝0
  • 关注0
  • 发帖数1377
阅读:5038回复:0

vue toggle做一个点击切换class

楼主#
更多 发布于:2018-10-10 23:18
<template>
    <div>
        <span :class="{'bg-primary text-danger':isA,'bg-success 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>
游客


返回顶部