牛骨文教育服务平台(让学习变的简单)
博文笔记

vue toggle做一个点击切换class

创建时间:2017-04-10 投稿人: 浏览次数:8023

vue toggle做一个点击切换class

<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>
阅读更多
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。