vue toggle做一个点击切换class

来源:互联网 发布:人工智能程序源代码 编辑:程序博客网 时间:2024/05/22 02:29

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>
0 0
原创粉丝点击