Vue切換導航菜單、標籤切換,實現class切換

vue導航切換

HTML

 <div class="text">
        <input type="button" :class = "isActive == index?'btn-success':''"    v-for="(item,index) in btnList" class="btn btn-rz mr-5 radius"  @click="changeStatus(index)" :value="item.text">
    </div>

 CSS

     

.btn-success {color:#fff;background-color:#429842;border-color:#429842}.

JS


    var vm = new Vue({
        el: "#app",
        data: {
            btnList:[
                {text:'全部'},
                {text:'已處理'},
                {text:'待處理'},
            ],
            isActive:0,
        },
        methods: {
            //切換菜單
            changeStatus:function(index){
                this.status = index
                this.getList()
            },
        }
})

 

發佈了6 篇原創文章 · 獲贊 22 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章