This article shares the specific code for WeChat applet to achieve Tab switching effect for your reference. The specific content is as follows How to useThe code is as follows (example): Define a status status data: { status: 0, }, The code is as follows (example): When clicking on the switch, use the status to switch according to the index subscript to achieve js code: handtab(e) { console.log(e); let index = e.currentTarget.dataset.index console.log(index); this.setData({ currentIndex: index, status: e.currentTarget.dataset.index //When clicking on the switch, use the status to switch according to the index subscript}) }, wxml code: <view> <block wx:for="{{data}}" wx-key="index" class="list_top"> <view data-index="{{index}}" class="list_one {{index==currentIndex?'active':''}}" bindtap="handtab">{{item.name}} </view> </block> <block wx:for="{{shopList}}" wx:key="index"> <view class="shopList_box" bindtap="handDetail" data-id="{{item.goods_id}}" wx:if="{{status==0}}"> //Use wx:if status == 0 in wxml to change the tab switch to show and hide the following part <view class="shopList_left"> <image src="{{item.goods_big_logo}}"></image> </view> <view class="shopList_right"> <text class="right">{{item.goods_name}}</text> <text class="price">¥{{item.goods_price}}</text> </view> </view> </block> <block> //status==1<view wx:if="{{status==1}}">2</view> </block> <block> //status==2<view wx:if="{{status==2}}">3</view> </block> </view> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: How to implement mysql database backup in golang
>>: How to set static IP in centOS7 NET mode
Functions about null in MySql IFNULL ISNULL NULLI...
I recently used Docker to upgrade a project. I ha...
Use indexes to speed up queries 1. Introduction I...
vue scaffolding -> vue.cli Quickly create a la...
For security reasons, MySql-Server only allows th...
When we learn HTML, the image tag <img> int...
Step 1: Install Stow In this example, we are usin...
Rendering Example Code Today we are going to use ...
Find the problem Today, when I tried to modify th...
Overview of MySQL MySQL is a relational database ...
Table of contents 1. Understanding 2. Use 1. h() ...
Experimental environment: 1. Three CentOS 7 serve...
Many people say that IE6 does not support PNG tra...
Nginx cross-domain configuration does not take ef...
Preface Recently, I found a pitfall in upgrading ...