uniapp uview全屏選項卡
| 選項1 | 選項2 | 選項3 |
| 內容 | ||
選項個數和內容不確定
想到的方法是點擊任意一選項出現相應的選項內容
出現bug:滑動滑塊選項激活狀態會變化 但內容不會變
出現bug原因:uview框架是一個選項卡對應一個選項內容,理論上我應該有三個選項內容 但由於選項個數不確定 我實現思路只需一個選項卡
uview只有一個change事件
| change | 點擊標簽時觸發 | index: 點擊了第幾個tab,索引從0開始 |
解決方法:滑動的時候也調用接口
1 // tab欄切換 2 change(index) { 3 this.swiperCurrent = index; 4 this.current = index; 5 this.getKeList(this.list[index].id); 6 }, 7 transition({ 8 detail: { 9 dx 10 } 11 }) { 12 this.$refs.tabs.setDx(dx); 13 }, 14 animationfinish({ 15 detail: { 16 current 17 } 18 }) { 19 this.$refs.tabs.setFinishCurrent(current); 20 this.swiperCurrent = current; 21 this.current = current; 22 this.getKeList(this.list[current].id); 23 }
