<view class="context">
<view class="left">
<scroll-view scroll-y
style="height: {
{ height }}"
scroll-top="{
{ navScrollTop }}"
scroll-into-view="item{
{ currentIndex }}"
>
<view
wx:for="{
{ navList }}"
wx:key="index"
data-id="item{
{index}}"
data-index="{
{ index }}"
id="item{
{index}}"
class="{
{ currentIndex == index ? 'active' : '' }}"
catchtap="changeNav"
>
{
{
item.title }}
</view>
</scroll-view>
</view>
<view class="right">
<scroll-view scroll-y
style="height: {
{ height }}"
scroll-with-animation
scroll-into-view = "{
{ id }}"
bindscroll='productScroll'>
<view class="item"
wx:for="{
{ productList }}"
wx:key="index"
id='product-item{
{index}}'
>
<view class="title"><text>{
{
item.title }}</text></view>
<view class="list"
wx:for="{
{ item.list }}"
wx:for-item="list"
wx:key="index">
<image src="{
{ list.imgURL }}"></image>
<text>{
{
list.name }}</text>
</view>
</view>
</scroll-view>
</view>
</view>
.context {
box-sizing: border-box;
display: flex;
}
.context .left {
box-sizing: border-box;
}
.context .left scroll-view {
height: 100%;
flex-shrink: 0
}
.context .left view {
font-size: 28rpx;
height: 70rpx;
line-height: 70rpx;
background: #ccc;
box-sizing: border-box;
padding: 0 20rpx
}
.context .left view.active {
color: #f00
}
.context .right {
text-align: center;
font-size: 30rpx;
font-weight: 700;
flex: 1;
line-height: 50rpx;
}
.context .list {
box-sizing: border-box;
display: flex;
align-items: center;
padding: 16rpx 24rpx;
}
.context image {
width: 120rpx;
height: 120rpx;
}
Page({
data: {
navList: [
{
title: '家用电器' },
{
title: '家居用品' },
{
title: '电脑办公' },
{
title: '食品酒类' },
{
title: '家用电器' },
{
title: '家居用品' },
{
title: '电脑办公' },
{
title: '食品酒类' },
{