国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

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

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

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

沒有展開時

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

點擊展開之后

vue循環(huán)中點擊選中再點擊取消(單選)的實現(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='你來談?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; } } }

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

效果如下:

vue循環(huán)中點擊選中再點擊取消(單選)的實現(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)中點擊選中再點擊取消(單選)的實現(xiàn)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 梅州市| 乌兰浩特市| 岢岚县| 科技| 琼结县| 定日县| 启东市| 三穗县| 伊金霍洛旗| 清水河县| 新疆| 瑞安市| 峡江县| 永济市| 涿州市| 宾川县| 民丰县| 那坡县| 芜湖县| 奇台县| 海伦市| 西和县| 库伦旗| 宜都市| 沙雅县| 龙陵县| 花莲县| 沁水县| 霞浦县| 五指山市| 右玉县| 锡林郭勒盟| 桦南县| 额尔古纳市| 高密市| 九台市| 榕江县| 景谷| 泗水县| 石河子市| 全南县|