> 效果如圖

> 這里實現的是三組 list 中的 點擊 toggle事件
> html 代碼
```
<div id="app">
<div v-for="(item, index) in list" :key="index">
<p v-show="index === activeIndex" :key="index">{{item}}--{{index}}</p>
<div style="background: cadetblue;width: 100px;height: 100px" @click="toggle(index, 1)">test</div>
</div>
<div v-for="(item, index) in list2" :key="index">
<p v-show="index === activeIndex2" :key="index">{{item}}--{{index}}</p>
<div style="background: cadetblue;width: 100px;height: 100px" @click="toggle(index, 2)">test</div>
</div>
<div v-for="(item, index) in list3" :key="index">
<p v-show="index === activeIndex3" :key="index">{{item}}--{{index}}</p>
<div style="background: cadetblue;width: 100px;height: 100px" @click="toggle(index, 3)">test</div>
</div>
</div>
```
> js 代碼
```
var vm = new Vue({
el: '#app',
data() {
return {
list: [
'111',
'222',
'333',
'444',
'555'
],
list2: [
'111',
'222',
'333',
'444',
'555'
],
list3: [
'111',
'222',
'333',
'444',
'555'
],
activeIndex: '',
activeIndex2: '',
activeIndex3: ''
}
},
methods: {
toggle(index, num) {
this.activeIndex = this.activeIndex2 = this.activeIndex3 = ''
switch (num) {
case 1:
this.activeIndex = index;
break;
case 2:
this.activeIndex2 = index;
break;
case 3:
this.activeIndex3 = index
break;
default:
}
}
},
})
```
- 空白目錄
- css實用樣式
- css--下拉欄的幾種設計
- css--圖片陰影以及浮起的效果
- css--圖片翻轉二:自動翻轉
- css--圖片翻轉一:滑過翻轉
- css--三種loading特效
- css--圖片遮罩效果實現
- css--又是三種loading特效
- css--帶三角形的圖形實現
- js demo
- 原生demo
- 1. 原生js實現輪播圖
- 2. 倒計時按鈕
- 3. 動態添加表格
- 4. checkbox全選反選
- 5. 小米登錄方式切換
- 6. 點擊事件
- 7. 個人網頁導航條(二)點擊滾動
- 8. 瀑布流實現!
- 9. 個人網頁導航條(一)滑動固定
- 10. 定時器實現淡入淡出效果
- 11. 輪播圖setTimeout版
- jQuery demo
- 1. 輪播圖實現!
- 2. 成都小風車導航特效
- html組件
- html--導航欄(家居醫生)
- html--登錄頁面(小米登錄)
- html--響應式導航條(木兮地板)
- html--搜索欄
- Vue demo
- 1. mvvm實現動態添加表格
- 2. 豆瓣TOP250渲染
- 3. 制作一段跑馬燈文字
- 3.1. vue 單行文字自動跑馬燈效果
- 4. 利用豆瓣接口搜索書籍
- 5. 制作簡易計算器
- 6. 創建一個點贊組件
- 7. 列表添加刪除動畫
- 8. isShow手風琴原理
- 9. tab欄切換