溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

vue列表單項展開收縮功能怎么實現

發(fā)布時間:2022-10-24 14:13:10 來源:億速云 閱讀:136 作者:iii 欄目:開發(fā)技術

這篇文章主要講解了“vue列表單項展開收縮功能怎么實現”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“vue列表單項展開收縮功能怎么實現”吧!

代碼邏輯

###template部分:已去除與本文不相關的功能代碼

<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部分:已去除與本文不相關的功能代碼

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) {
	  // 功能代碼省略
  }
}

vue是什么

Vue是一套用于構建用戶界面的漸進式JavaScript框架,Vue與其它大型框架的區(qū)別是,使用Vue可以自底向上逐層應用,其核心庫只關注視圖層,方便與第三方庫和項目整合,且使用Vue可以采用單文件組件和Vue生態(tài)系統(tǒng)支持的庫開發(fā)復雜的單頁應用。

感謝各位的閱讀,以上就是“vue列表單項展開收縮功能怎么實現”的內容了,經過本文的學習后,相信大家對vue列表單項展開收縮功能怎么實現這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

vue
AI