最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序?qū)崿F(xiàn)商品分類列表

 更新時(shí)間:2022年05月22日 09:00:23   作者:J1FengZ  
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)商品分類列表,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)商品分類列表的具體代碼,供大家參考,具體內(nèi)容如下

一、效果展示

二、代碼實(shí)現(xiàn)

<!-- wxml -->
<view class="container">
<!-- 商品列表 -->
?? ?<view class="cate">
?? ??? ?<!-- 左側(cè)導(dǎo)航 -->
?? ??? ?<scroll-view scroll-y class="nav-left">
?? ??? ??? ?<view?
?? ??? ??? ??? ?wx:for="{{List}}"
?? ??? ??? ??? ?wx:key="this"
?? ??? ??? ??? ?class="nav-left-item {{currentIndex_L == index ? 'L-item-active' : ''}}"?
?? ??? ??? ??? ?bindtap="bindleLeftItemTap"?
?? ??? ??? ??? ?data-index="{{index}}" >
?? ??? ??? ??? ?<text class="nav-left-item-txt {{currentIndex_L == index ? 'L-i-txt-active' : ''}}">{{item.LeftName}}</text>
?? ??? ??? ?</view>
?? ??? ?</scroll-view>
?? ??? ?<!-- 右側(cè)導(dǎo)航 -->
?? ??? ?<scroll-view scroll-y scroll-top="{{scrollTop}}" class="nav-right">
?? ??? ??? ?<view?
?? ??? ??? ??? ?wx:for="{{List[currentIndex_L].RightList}}"
?? ??? ??? ??? ?wx:key="this"
?? ??? ??? ??? ?class="nav-right-item"
?? ??? ??? ??? ?bindtap="bindleRightItemTap"?
?? ??? ??? ??? ?data-index="{{index}}">
?? ??? ??? ??? ?<text class="nav-right-item-txt {{currentIndex_R == index ? 'R-i-txt-active' : ''}}">{{item.RightName}}</text>
?? ??? ??? ??? ?<view class="{{currentIndex_R == index ? 'image-select' : ''}}">
?? ??? ??? ??? ??? ?<image wx:if="{{currentIndex_R == index}}" class="item-select" src="../icon/Hook_icon.png"/>
??? ??? ??? ??? ?</view>
?? ??? ??? ?</view>
?? ??? ?</scroll-view>
?? ?</view>
?? ?<view class="pd32 btn-find">
?? ??? ?<view bindtap="toDetail">
?? ??? ??? ?<view class="btn-big">查看詳情</view>
?? ??? ?</view>
?? ?</view>
</view>
// js
// 假數(shù)據(jù)
let List = [
?? ?{
?? ??? ?"LeftId": 1,
?? ??? ?"LeftName": "分類1",
?? ??? ?"RightList": [
?? ??? ?{
?? ??? ??? ?"RightId": 11,
?? ??? ??? ?"RightName": "商品11"
?? ??? ?},
?? ??? ?]
?? ?},
?? ?{
?? ??? ?"LeftId": 2,
?? ??? ?"LeftName": "分類2",
?? ??? ?"RightList": [
?? ??? ?{
?? ??? ??? ?"RightId": 21,
?? ??? ??? ?"RightName": "商品21"
?? ??? ?},
?? ??? ?]
?? ?},
]

Page({
?? ?/**?? ?
?? ? * 頁(yè)面的初始數(shù)據(jù)
?? ? */
?? ?data: {
?? ??? ?List : List,
?? ??? ?selectLeftId : null,
?? ??? ?selectRightId : null,
?? ??? ?currentIndex_L : null,
?? ??? ?currentIndex_R : null,
?? ??? ?scrollTop : 0
?? ?},
?? ?
?? ?/**
?? ? * 左導(dǎo)航點(diǎn)擊事件
?? ? */
?? ?bindleLeftItemTap(e) {
?? ??? ?const {index} = e.currentTarget.dataset;
?? ??? ?this.setData({
?? ??? ??? ?currentIndex_L:index,
?? ??? ??? ?currentIndex_R : null,
?? ??? ??? ?selectLeftId : this.data.List[index].LeftId,
?? ??? ??? ?selectRightId : null,
?? ??? ??? ?scrollTop : 0,
?? ??? ?})?
?? ?},

?? ?/**
?? ? * 右導(dǎo)航點(diǎn)擊事件
?? ? */
?? ?bindleRightItemTap(e) {
?? ??? ?const {index} = e.currentTarget.dataset;
?? ??? ?let index_L = this.data.currentIndex_L;
?? ??? ?this.setData({
?? ??? ??? ?currentIndex_R : index,
?? ??? ??? ?selectRightId : this.data.List[index_L].RightList[index].RightId,
?? ??? ?})?
?? ?},

?? ?/**
?? ? * 底部查看詳情按鈕點(diǎn)擊事件
?? ? */
?? ?toDetail(e) {
?? ??? ?var selectLeftId = this.data.selectLeftId;
?? ??? ?var selectRightId = this.data.selectRightId;

?? ??? ?if(selectLeftId === null){
?? ??? ??? ?wx.showToast({
?? ??? ??? ??? ?title: '請(qǐng)選擇一種分類或商品!',
?? ??? ??? ??? ?icon: 'none',
?? ??? ??? ??? ?duration: 1500,
?? ??? ??? ??? ?mask: true
?? ??? ??? ?});
?? ??? ??? ?return;
?? ??? ?}
?? ??? ?if(selectRightId != null) {
?? ??? ??? ?wx.navigateTo({
?? ??? ??? ??? ?url: '/pages/Detail/Detail' + '?' +
?? ??? ??? ??? ?'selectLeftId=' + selectLeftId +?
?? ??? ??? ??? ?'&selectRightId=' + selectRightId,
?? ??? ??? ??? ?});
?? ??? ??? ?}
?? ??? ??? ?else {
?? ??? ??? ??? ?wx.navigateTo({
?? ??? ??? ??? ?url: '/pages/Detail/Detail' + '?' +
?? ??? ??? ??? ?'&selectLeftId=' + selectLeftId,
?? ??? ??? ?});
?? ??? ?}?? ?
?? ?},
})

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

澄迈县| 且末县| 类乌齐县| 民乐县| 五台县| 永丰县| 宜章县| 襄城县| 凤翔县| 腾冲县| 开阳县| 册亨县| 营山县| 奉新县| 南昌县| 新化县| 青浦区| 达拉特旗| 靖州| 赤壁市| 永登县| 马山县| 汝州市| 鹿泉市| 资溪县| 治多县| 旌德县| 东港市| 通化县| 湘乡市| 武定县| 牙克石市| 加查县| 定安县| 怀化市| 谢通门县| 凌云县| 开平市| 承德县| 闻喜县| 宜昌市|