欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

vue怎么實(shí)現(xiàn)列表單項(xiàng)展開(kāi)收縮功能

本文小編為大家詳細(xì)介紹“vue怎么實(shí)現(xiàn)列表單項(xiàng)展開(kāi)收縮功能”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“vue怎么實(shí)現(xiàn)列表單項(xiàng)展開(kāi)收縮功能”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來(lái)學(xué)習(xí)新知識(shí)吧。

10年積累的成都網(wǎng)站建設(shè)、網(wǎng)站制作經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問(wèn)題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有額濟(jì)納免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

展開(kāi)效果–看紅框區(qū)域

vue怎么實(shí)現(xiàn)列表單項(xiàng)展開(kāi)收縮功能

收縮效果–看紅框區(qū)域

 vue怎么實(shí)現(xiàn)列表單項(xiàng)展開(kāi)收縮功能

接下來(lái)看代碼邏輯

###template部分:已去除與本文不相關(guān)的功能代碼

<li class="main-video"v-for="(item, index) of courseSubList" :key="item.id">
  <div class="audio-name">
    <div class="img-l">
      <span class="img-l-num">{{index+1}}</span>
      <span class="img-l-name">{{item.subName}}</span>
    </div>
    <div class="img-r" @click="showHide(index)" ref="arrow">
      <i class="iconfont">&#xe606;</i>
    </div>
  </div>
  <div class="audio-body" ref="child">
    <div class="body-l">
      <p class="body-l-num body-l-num-video">
        <i class="iconfont">&#xe62e;</i>
      </p>
      <span class="body-l-name">{{item.fileName}}</span>
    </div>
    <div class="body-r">
      <i class="iconfont" @click="deletCourseSub(item.id)">&#xe62c;</i>
    </div>
  </div>
</li>

###js部分:已去除與本文不相關(guān)的功能代碼

data() {
	return {
		courseSubList: [], // 課程正文列表
	}
},
methods: {
  showHide(index) {
   if (this.$refs.child[index].style.display === 'none') {
    this.$refs.child[index].style.display = 'flex'
    this.$refs.arrow[index].style.transform = 'rotateX(0deg)'
   } else {
    this.$refs.child[index].style.display = 'none'
    this.$refs.arrow[index].style.transform = 'rotateX(180deg)'
   }
  },
  deletCourseSub(id) {
	  // 功能代碼省略
  }
}

###分析過(guò)程:

  1. 分別給展開(kāi)折疊的箭頭加ref="arrow"屬性;

  2. 分別給列表單項(xiàng)內(nèi)容區(qū)最外層標(biāo)簽即本文的class="audio-body"的標(biāo)簽加ref=“child”;

  3. 再給箭頭標(biāo)簽區(qū)域加個(gè)showHide(index)事件;

  4. 最后通過(guò)對(duì)應(yīng)的index利用vue的ref屬性改變對(duì)應(yīng)的列表單項(xiàng)展開(kāi)折疊。

讀到這里,這篇“vue怎么實(shí)現(xiàn)列表單項(xiàng)展開(kāi)收縮功能”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識(shí)點(diǎn)還需要大家自己動(dòng)手實(shí)踐使用過(guò)才能領(lǐng)會(huì),如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

分享標(biāo)題:vue怎么實(shí)現(xiàn)列表單項(xiàng)展開(kāi)收縮功能
鏈接URL:http://www.chinadenli.net/article12/geisdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄標(biāo)簽優(yōu)化全網(wǎng)營(yíng)銷推廣手機(jī)網(wǎng)站建設(shè)網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)