第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

vue判斷dom的class

vue判斷dom的class

蝴蝶不菲 2019-03-20 14:19:00
vue點擊給dom添加class然后獲取含有class的dom<div class="chose-ck" v-for="(item,index2) in colors" :key="index2" ref="chosebox">                                    <p>{{item.name}}</p>                                    <dt v-for="(item2,index) in item.childsCurGoods" :key="item2.id" :class="index==iac[index2]?'check':''" :id="item2.id" :data-chosename="item.name" :data-choseidname="item2.name" :data-chose="item.id" :data-id="item2.id" @click="chek(index2,index)" >                                        {{item2.name}}                                    </dt>                                </div>js    chek(index2, index) {            this.iac[index2] = index            this.iac = this.iac.concat([]);            this.checkchose()        },        checkchose:function(){            var chose=this            var chosedom=chose.$refs.chosebox            console.log(chosedom)            for (var i=0;i<chosedom.length;i++) {                var children=chosedom[i].children                for (var j=0;j<children.length;j++) {                        if(children[j].className=="check")                    {                        console.log(children[j])                    }                }            }                    }點擊過后獲取到的dom打印if(children[j].className=="check")加了判斷為什么打印出來的dom是點擊之前的dom
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 1001 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號