当前位置:网站首页>Applet with multiple tabs and Swipers + paging of each tab
Applet with multiple tabs and Swipers + paging of each tab
2022-07-03 17:43:00 【Twinkle, twinkle, twinkle, twinkle, twinkle, twinkle, twinkle, 】
wxml:
<!-- header -->
<view class="flex flex-col flex-fv flex-fh">
<view class="flex flex-hb flex-ve text-9EA0A4 font32">
<view class="flex flex-ve" bindtap="changeTab">
<view class="mr40 line_height1 {
{ activeIndex == 0 ? 'text-2E3238 font48 font-w':'' }}" data-index="0">tab0</view>
<view class="mr40 line_height1 {
{ activeIndex == 1 ? 'text-2E3238 font48 font-w ':'' }}" data-index="1">tab1</view>
<view class="mr40 line_height1 {
{ activeIndex == 2 ? 'text-2E3238 font48 font-w':'' }}" data-index="2">tab2</view>
</view>
</view>
<view class="f1">
<swiper class="flex-fv" bindchange="bindSwiperChange" current="{
{ activeIndex }}">
<!-- tab0 -->
<swiper-item class="bg-red">
<scroll-view class="flex-fv" scroll-y bindscrolltolower="scrolltolower">
<block wx:for="{
{ tabData[0].list }}" wx:key="index">
<view></view>
</block>
</scroll-view>
</swiper-item>
<!-- tab1 -->
<swiper-item class="bg-green">
<scroll-view class="flex-fv" scroll-y bindscrolltolower="scrolltolower">
<block wx:for="{
{ tabData[1].list }}" wx:key="index">
<view></view>
</block>
</scroll-view>
</swiper-item>
<!-- tab2 -->
<swiper-item class="bg-red">
<scroll-view class="flex-fv" scroll-y bindscrolltolower="scrolltolower">
<block wx:for="{
{ tabData[2].list }}" wx:key="index">
<view style="height: 200rpx;" class="bg-white mt20">{
{ index }}</view>
</block>
</scroll-view>
</swiper-item>
</swiper>
</view>
</view>
js:
import { dateFormatStr } from "../../../utils/util";
const app = getApp()
Page({
/**
* Initial data of the page
*/
data: {
tabData:[
{
list:[],
page:1
},
{
list:[],
page:2
},
{
list:[],
page:3
}
],
activeIndex:0,
page:1,
pageSize:10,
userInfo: {}, // Login personal data
},
/**
* Life cycle function -- Monitor page loading
*/
onLoad(options) {
this.setData({
userInfo: app.globalData.userInfo,
});
this.getList()
},
//tab Switch
changeTab(e){
const { index } = e.target.dataset;
if(index >= 0){
this.setData({
activeIndex:index,
});
}
this.getList()
},
/**
* swiper Switch
* @param {*} e
*/
bindSwiperChange:function(e){
var { current } = e.detail;
this.setData({
activeIndex:current,
});
this.getList()
},
/**
* obtain list
*/
getList(){
const { tabData,activeIndex,pageSize } = this.data
const addlist = []
this.setData({
[`tabData[${activeIndex}].list`]:tabData[activeIndex].list.concat(addlist)
})
},
/**
* Handling function of page pull bottom event
*/
scrolltolower() {
const { tabData,activeIndex } = this.data
console.log('tabData:',tabData)
tabData[activeIndex].page++
this.getList()
},
/**
* Users click the upper right corner to share
*/
onShareAppMessage() {
}
})
边栏推荐
- [UE4] brush Arctic pack high quality Arctic terrain pack
- [vscode] convert tabs to spaces
- Stm32h7 Hal library SPI DMA transmission has been in busy solution
- Leetcode 108 converts an ordered array into a binary search tree -- recursive method
- Comparison of kotlin collaboration + retro build network request schemes
- Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code
- ES6类的继承
- 【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
- kubernetes资源对象介绍及常用命令(四)
- PR second time
猜你喜欢
PS screen printing brush 131, many illustrators have followed suit
国内如何购买Google Colab会员
vs2013已阻止安装程序,需安装IE10
Golang单元测试、Mock测试以及基准测试
Select 3 fcpx plug-ins. Come and see if you like them
Swm32 series Tutorial 4 port mapping and serial port application
2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)
Implementation of Tetris in C language
QT adjust win screen brightness and sound size
1147_ Makefile learning_ Target files and dependent files in makefile
随机推荐
Vs2013 has blocked the installer, and ie10 needs to be installed
[combinatorics] recursive equation (four cases where the non-homogeneous part of a linear non-homogeneous recursive equation with constant coefficients is the general solution of the combination of po
鸿蒙第三次培训
Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
[combinatorics] recursive equation (general solution structure of recursive equation with multiple roots | linear independent solution | general solution with multiple roots | solution example of recu
Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source
Brief introduction to the core functions of automatic penetration testing tool
Talk about the design and implementation logic of payment process
[RT thread] NXP rt10xx device driver framework -- RTC construction and use
[RT thread] NXP rt10xx device driver framework -- pin construction and use
First day of rhcsa study
Managing multiple selections with MVVM - managing multiple selections with MVVM
【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用
Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
AcWing 3438. 数制转换
AcWing 4489. 最长子序列
c# . Net tool ecosystem
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
Research on Swift
ES6类的继承