
wxml代码
<view class="search">
<input class="search-box" placeholder='痘研商城' bindtap='goodsName'></input>
<image src="{
{staticImg}}index/iconSearch.png" class='question-mark'></image>
</view>
<view class='tui-fixed-left'>
<scroll-view class='tui-city-scroll' scroll-x="true" scroll-y="true" style='height:92%;' scroll-with-animation="true"
scroll-top="{
{leftMenuTop}}">
<text class="menu-item {
{index === currentActiveIndex ? 'menu-active' : ''}}" wx:for="{
{navList}}" wx:key="unique"
data-index="{
{index}}" id='{
{index}}' catchtap='changeMenu'>{
{item.c_name}}</text>
</scroll-view>
</view>
<view class='content'>
<scroll-view class='tui-city-scroll-y' scroll-y="true" style='height:92%;' scroll-with-animation="true"
scroll-top="{
{rightProTop}}" bindscroll="scroll">
<view class='pro-item' wx:for="{
{navList}}" wx:key="unique">
<view class='tui-list-head' id='NAV{
{index}}'>{
{item.c_name}}</view>
<view class='tui-list-li'>
<view class='goods-box' wx:for-item='items' wx:for="{
{item.list}}" wx:key="unique">
<image class='goodsImg' src='{
{items.url}}'></image>
<view class='goodsName'>{
{items.goodsName}}</view>
</view>
</view>
</view>
</scroll-view>
</view>
js代码
var app = getApp();
let proListToTop = [],
menuToTop = [],
MENU = 0,
windowHeight, timeoutId;
Page({
data: {
staticImg: app.globalData.staticImg,
currentActiveIndex: 0,
navList: [{
c_id: "01",
c_name: '电脑办公',
list: [{
id: 1,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
{
id: 2,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
{
id: 3,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
{
id: 4,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
{
id: 5,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
]
},
{
c_id: "02",
c_name: '祛痘',
list: [{
id: 1,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
{
id: 2,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
{
id: 3,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
{
id: 4,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
{
id: 5,
url: 'https://resource.yirenheju.cn/wechat/index/err.png',
goodsName: '玩具',
},
]
},
{
c_id: "02",
c_name: '化妆品',
list: <