微信小程序中的
最终效果图:
设计思路:
1.了解scroll-view
scroll-view组件可以实现左滑与上下滑动的效果
scroll-x=“true"开启水平滑动,
scroll-y=“true"开启垂直滑动
2.了解swiper组件
Swiper能实现触屏焦点图、触屏Tab切换、触屏多图切换等常用效果。所以要实现点击切换效果需要使用到它。
使用格式:
添加要循环的内容
3.先写最顶层的分类
导航栏重点在切换效果,当点击全部的时候查询出所有物品、点击待付款只显示未付款的物品。
切换的核心思路是先获取点击的索引;
data-current=”{
{item.index}}”
this.data.currtab === e.target.dataset.current
当获取到索引值后:
switch (this.data.currtab) {
case 0:
that.allShow0()
break
case 1:
that.item1Show0()
break
case 2:
that.item2Show0()
break
case 3