当前位置:网站首页>小程序 多tab 多swiper + 每个tab分页
小程序 多tab 多swiper + 每个tab分页
2022-07-03 17:42:00 【一闪一闪亮晶晶,漫天都是小星星】
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({
/**
* 页面的初始数据
*/
data: {
tabData:[
{
list:[],
page:1
},
{
list:[],
page:2
},
{
list:[],
page:3
}
],
activeIndex:0,
page:1,
pageSize:10,
userInfo: {}, //登录人个人资料
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
userInfo: app.globalData.userInfo,
});
this.getList()
},
//tab切换
changeTab(e){
const { index } = e.target.dataset;
if(index >= 0){
this.setData({
activeIndex:index,
});
}
this.getList()
},
/**
* swiper切换
* @param {*} e
*/
bindSwiperChange:function(e){
var { current } = e.detail;
this.setData({
activeIndex:current,
});
this.getList()
},
/**
* 获取list
*/
getList(){
const { tabData,activeIndex,pageSize } = this.data
const addlist = []
this.setData({
[`tabData[${activeIndex}].list`]:tabData[activeIndex].list.concat(addlist)
})
},
/**
* 页面上拉触底事件的处理函数
*/
scrolltolower() {
const { tabData,activeIndex } = this.data
console.log('tabData:',tabData)
tabData[activeIndex].page++
this.getList()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
边栏推荐
- MinGW compile boost library
- Managing multiple selections with MVVM - managing multiple selections with MVVM
- Applet setting multi account debugging
- c# .net 工具生态
- IntelliJ 2021.3 short command line when running applications
- PHP processing - watermark images (text, etc.)
- 聊聊支付流程的设计与实现逻辑
- Write a program to process a list container of string type. Find a special value in the container 9.27: and delete it if found. Rewrite the above procedure with deque container.
- Global and Chinese health care OEM and ODM market status survey and investment planning recommendations report 2022-2028
- [RT thread] NXP rt10xx device driver framework -- pin construction and use
猜你喜欢
Unity notes unityxr simple to use
kubernetes资源对象介绍及常用命令(五)-(NFS&PV&PVC)
STM32 realizes 74HC595 control
【RT-Thread】nxp rt10xx 设备驱动框架之--Pin搭建和使用
2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)
聊聊支付流程的设计与实现逻辑
鸿蒙第三次培训
[RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework
MySQL has been stopped in the configuration interface during installation
Collection of the most beautiful graduation photos in the graduation season, collection of excellent graduation photos
随机推荐
Where is the database account used when running SQL tasks in data warehouse tasks configured
Website with JS doesn't work in IE9 until the Developer Tools is activated
kubernetes资源对象介绍及常用命令(四)
PUT vs. POST for Uploading Files - RESTful API to be Built Using Zend Framework
Talk about the design and implementation logic of payment process
Analyse ArrayList 3: suppression d'éléments
微服务组件Sentinel控制台调用
1164 Good in C
Online assignment 3 of mobile Internet technology in the 20th autumn of electronic technology [standard answer]
Cloud primordial weekly | CNCF released the 2021 cloud primordial development status report, which was released on istio 1.13
Financial management (Higher Vocational College) financial management online Assignment 1 in autumn 20
Swm32 series Tutorial 4 port mapping and serial port application
[mathematical logic] equivalent calculus and reasoning calculus of predicate logic (individual word | predicate | quantifier | predicate logic formula | two basic formulas | proposition symbolization
[combinatorics] recursive equation (special solution form | special solution solving method | special solution example)
Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)
Where is the monitoring page of RDS database?
Interviewer: why is the value nil not equal to nil?
[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
Kubernetes resource object introduction and common commands (4)
Test your trained model