久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

vue循環(huán)中點(diǎn)擊選中再點(diǎn)擊取消(單選)的實(shí)現(xiàn)

瀏覽:9日期:2022-11-25 09:01:17

沒(méi)有展開(kāi)時(shí)

vue循環(huán)中點(diǎn)擊選中再點(diǎn)擊取消(單選)的實(shí)現(xiàn)

點(diǎn)擊展開(kāi)之后

vue循環(huán)中點(diǎn)擊選中再點(diǎn)擊取消(單選)的實(shí)現(xiàn)

<div class='flashread_item_box_time'> <span class='moment_time'>9分鐘前</span> <div class='flashread_item_box_zan'> <span class='flashread_item_box_item'><i class='iconfont icon-changyongtubiao-mianxing-'></i>10</span> <span @click='tocomment(index)'><i :class='{showcolor:currentTab==index}'></i>10</span> </div> </div> <div :class='{’showcomment’:currentTab==index}'> <div class='textarea_com'> <textarea placeholder='你來(lái)談?wù)劊? v-on:input='change' v-model='comment'></textarea> <button :class='{’showcolor’:showcombtn}'>發(fā)表</button> </div> </div>

data(){ return{ currentTab:-1, flashreadlists:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15], showcombtn:false, comment:’’ } }, methods:{ change(){ if(this.comment.length>=1){ this.showcombtn=true }else{ this.showcombtn=false } }, tocomment(index){ if(index!=this.currentTab){ this.currentTab = index; }else{ this.currentTab = -1; } } }

補(bǔ)充知識(shí):vue 循環(huán)多個(gè)標(biāo)簽,點(diǎn)擊標(biāo)簽變色,再點(diǎn)擊取消,可以同時(shí)點(diǎn)擊多個(gè)

效果如下:

vue循環(huán)中點(diǎn)擊選中再點(diǎn)擊取消(單選)的實(shí)現(xiàn)

1.

<div class='relFacilityTitcon'> <i v-for='(item,index) in facilityList' :key='index' @click='changeSpan(index);' : >{{item}}</i></div>

2.

.padding .relWarp .relFacility .relFacilityTitcon { /* border: 1px solid red; */ /* line-height: 20px; */ padding: 0 .24rem; font-size :10px; } .padding .relWarp .relFacility .relFacilityTitcon i {/* height:20px; */ display: inline-block; /* margin: 0 5px; */ height: 20px; line-height: 20px; padding: 0 .16rem; /* width: auto; */ font-size: 10px; color: #97979f; border-radius: 5px; border: 1px solid #97979f; margin-right: 10px; margin-top: 10px; font-style: normal; /* padding:1px 7px; */ /* display: inline-block; */ } .padding .relWarp .relFacility .relFacilityTitcon .bgcolor { border: 1px solid orange; color: orange; } .padding .relWarp .relFacility .relFacilityTitcon i:last-child { margin-right: 0; }

3.

methods: { changeSpan(index){let arrIndex = this.spanIndex.indexOf(index);// console.log(arrIndex);if(arrIndex>-1){ this.spanIndex.splice(arrIndex,1);}else{ this.spanIndex.push(index);} },

以上這篇vue循環(huán)中點(diǎn)擊選中再點(diǎn)擊取消(單選)的實(shí)現(xiàn)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 泽州县| 什邡市| 游戏| 北票市| 安义县| 内黄县| 台前县| 上虞市| 连云港市| 津南区| 施秉县| 靖江市| 九江市| 道孚县| 锡林郭勒盟| 闵行区| 澄迈县| 融水| 惠来县| 深州市| 东海县| 茂名市| 平塘县| 阜城县| 禄劝| 西贡区| 襄汾县| 舒城县| 进贤县| 阜阳市| 汤原县| 保德县| 高碑店市| 民乐县| 仁布县| 天峨县| 辛集市| 双流县| 金山区| 浦县| 车险|