这段时间在产品中需要做一个商品分类列表的展示页面,产品是一个小程序商城。在这里对这一块做个梳理。
首先为了使左右两边都能够上下滑动,使用scroll-view组件
<!--这里引入了一段商品的列表项模板文件-->
<import src ="../../../templates/shop/shop.wxml"/>
<view class='sort-container'>
<!--这是左边的标题栏-->
<scroll-view scroll-y='{
{true}}' class='sort-title'>
<view wx:for='{
{sort}}' wx:key='{
{index}}' class='{
{index==cur?"active":""}}' id='{
{item.id}}' data-index='{
{index}}' bindtap='changeSort'>{
{item.txt}}</view>
</scroll-view>
<!--这是右边的内容栏-->
<scroll-view scroll-y='{
{true}}' class='sort-content' scroll-into-view='{
{curId}}' scroll-with-animation='{
{true}}' bindscroll='monitor