码迷,mamicode.com
首页 > 其他好文 > 详细

v-bind:class

时间:2019-06-20 10:53:16      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:bsp   cli   改变   eth   idt   this   href   src   round   

<!DOCTYPE html>
<html lang="zh">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <link href="../css/style.css" rel="stylesheet"> </head>

<body>
<div id="myApp">
    <div :class="myClass">红色文本</div>
    <button @click="btnClick">改变class吧</button>
</div>
<script>
    var myApp = new Vue({
        el: #myApp,
        data: {
            myClass: {
                active: true,
                big: true,
            },
        },
        methods: {
            btnClick: function(){
                this.myClass.active = !this.myClass.active;
                this.myClass.big = !this.myClass.big;
            },
        },
    });
</script>
</body>

</html>

 

v-bind:class

标签:bsp   cli   改变   eth   idt   this   href   src   round   

原文地址:https://www.cnblogs.com/Jeely/p/11057260.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!