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 }