当前位置:网站首页>How to write the code of wechat applet implementation tab
How to write the code of wechat applet implementation tab
2022-07-25 08:56:00 【Yisu cloud】
How to write the code of wechat applet implementation tab
This article mainly introduces “ How to write the code of wechat applet implementation tab ” Knowledge about , Xiaobian shows you the operation process through practical cases , The operation method is simple and fast , Practical , Hope this article “ How to write the code of wechat applet implementation tab ” The article can help you solve problems .
design sketch

Implemented function : Click the tab above , The following product content is switched , Slide the product page below , The above options also switch with the page .
text.wxml:
<!-- classification --><view class='listMiddle swiper-tab'> <view class='middle {{currentTab==0? "action" : ""}}' data-current="0" bindtap="clickTab"> All </view> <view class='middle {{currentTab==1? "action":""}}' data-current="1" bindtap="clickTab"> classification 1 </view> <view class='middle {{currentTab==2? "action":""}}' data-current="2" bindtap="clickTab"> classification 2 </view> <view class='middle {{currentTab==3? "action":""}}' data-current="3" bindtap="clickTab"> classification 3 </view></view><!-- Selected goods --><swiper current="{{currentTab}}" duration="300" bindchange="swiperTab" >// Note that there is only one piece of data written in the loop , To achieve multiple pieces of data , Learn to nest loops with data ~~ <swiper-item wx:for="{{jingxuan}}"> <view class='loopmiddle'> <view class='lo-left'> <image src='{{item.hua}}'></image> </view> <view class='lo-middle'> <view>{{item.guo}}</view> <view>{{item.zhigong}}</view> <view class='loo-bottom'> <text>{{item.qi}}</text> <image src='{{item.huo}}'></image> <text>{{item.fen}}</text> </view> </view> <view class='lo-right'> <image src='{{item.xiaoche}}'></image> </view> </view> </swiper-item></swiper>test.js
var app = getApp()Page({ /** * Initial data of the page */ data: { jingxuan: [{ hua: "../../assets/hua.png", guo: "9.9 element 1 Jin explodes - A Millennium virgin fruit ", zhigong: " Direct supply from the place of origin , About one box 8 Jin ", qi: "¥71.90", huo: "../../assets/huomiao.png", fen: " Purchased 999 Share ", xiaoche: "../../assets/xiaoche.png", }, { hua: "../../assets/hua.png", guo: "9.9 element 1 Jin explodes - A Millennium virgin fruit ", zhigong: " Direct supply from the place of origin , About one box 8 Jin ", qi: "¥72.90", huo: "../../assets/huomiao.png", fen: " Purchased 999 Share ", xiaoche: "../../assets/xiaoche.png", }, { hua: "../../assets/hua.png", guo: "9.9 element 1 Jin explodes - A Millennium virgin fruit ", zhigong: " Direct supply from the place of origin , About one box 8 Jin ", qi: "¥73.90", huo: "../../assets/huomiao.png", fen: " Purchased 999 Share ", xiaoche: "../../assets/xiaoche.png", }, { hua: "../../assets/hua.png", guo: "9.9 element 1 Jin explodes - A Millennium virgin fruit ", zhigong: " Direct supply from the place of origin , About one box 8 Jin ", qi: "¥74.90", huo: "../../assets/huomiao.png", fen: " Purchased 999 Share ", xiaoche: "../../assets/xiaoche.png", }, ], currentTab: 0, }, // Slide switch swiperTab: function (e) { var that = this; that.setData({ currentTab: e.detail.current }); console.log(e.detail.current) }, // Click to switch clickTab: function (e) { var that = this; if (this.data.currentTab === e.target.dataset.current) { return false; } else { that.setData({ currentTab: e.target.dataset.current }) } } ,text.wxss
/* classification */.listMiddle{ display: flex; font-size: 40rpx; border-bottom: 1px solid #ebebeb; height: 90rpx; line-height: 90rpx; }.middle{ margin-left: 60rpx; height: 90rpx; width: 120rpx;}.action{ height: 90rpx; width: 120rpx; color: #3ad965; border-bottom:2px solid #3ad965;}/* Select products begin */.loopmiddle{ width: 690rpx; margin: 5rpx auto 0; /* overflow: hidden; */ display: flex; margin-bottom: 40rpx; border-bottom: 1rpx solid #eff0f4;}.lo-left{ /* float: left; */ height: 250rpx; width: 250rpx;}.lo-left image{ height: 250rpx; width: 250rpx;}.lo-middle{ margin-top:40rpx;}.lo-middle view:nth-child(1){ font-size:25rpx; color:#676767; margin-left: 10rpx;}.lo-middle view:nth-child(2){ font-size:20rpx; color:#adadad; margin-top:20rpx; margin-left: 10rpx;}.loo-bottom{ margin-top: 40rpx;}.loo-bottom text:nth-child(1){ margin-right: 15rpx; font-size:40rpx; color:#fe6400;}.loo-bottom text:last-child{ font-size:20rpx; color:#4b3333;}.loo-bottom image{ width: 35rpx; height: 35rpx; vertical-align: middle;}.lo-right{ width: 50rpx; height: 50rpx;}.lo-right image{ width: 50rpx; height: 50rpx;}.lo-right{ margin-top:170rpx;}.active{ color:aqua; border-bottom: 4rpx solid red;}.swiper-tab{ width: 100%; border-bottom: 2rpx solid #ccc; text-align: center; height: 88rpx; line-height: 88rpx; font-weight: bold;}About “ How to write the code of wechat applet implementation tab ” That's all for , Thanks for reading . If you want to know more about the industry , You can pay attention to the Yisu cloud industry information channel , Xiaobian will update different knowledge points for you every day .
边栏推荐
- Redis/Mysql知识概述
- Technical aspect ② what are the index types in MySQL and briefly introduce them? When do I need to create an index? When is it not necessary to create an index? Why does the query speed increase after
- This week's big news | FCC exposed Pico 4 VR all-in-one machine, and leipeng's parent company established a smart glasses laboratory
- Robot jumping problem
- [Development Tutorial 9] crazy shell · open source Bluetooth smart health watch - storage
- Wechat reservation applet graduation design of applet completion works (1) development outline
- Wechat sports field reservation of the finished works of the applet graduation project (4) opening report
- 附加:下半部分sql语句 区/县(数据表)
- Redis学习笔记
- JMeter test plan cannot be saved solution
猜你喜欢

LeetCode·83双周赛·6129.全0子数组的数目·数学

超赞的yolo目标检测训练所用垃圾分类数据集共享——标注好的约3000张

Wechat Reservation Reservation of applet completion works applet graduation project (8) graduation project thesis template

Wechat reservation of small program completion works (5) assignment book of small program graduation project

This is the worst controller layer code I've ever seen

This ten-year content industry infrastructure company is actually an invisible Web3 pioneer

js小游戏源码魔塔闯关下载

Tips for improving code sustainability, take connectto method as an example.

JMeter test plan cannot be saved solution

table表格展开内部行切换效果
随机推荐
PL/SQL工具导出sql文件所使用的命令是什么?
为什么说DAO是未来的公司形式
【npm】 无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
Wechat reservation applet graduation design of applet completion works (2) applet function
C语言基础
【无标题】
Keep your Eyes on the Lane: Real-time Attention-guided Lane Detection
Overview of redis/mysql knowledge
C语言实现二叉平衡树
艺术 NFT 的发展之路
附加:中半部分sql语句 区/县(数据表)
英特尔就产品延误向Xe HPG寻宝游戏获奖者道歉并公布奖品样貌
51单片机外设篇:蜂鸣器
Graduation project of wechat small program ordering system of small program completion works (4) opening report
360 degree drag panorama plug-in tpanorama.js
NFT guide for musicians
Qt|qlabole change line spacing when displaying multiple lines
PHP gets all child nodes under any parent node of the tree structure
Full solution of JDBC API
The operation cannot be completed because a folder or file in it is already open in another program