当前位置:网站首页>小程序 多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() {
}
})边栏推荐
- First day of rhcsa study
- POM in idea XML graying solution
- AcWing 4489. Longest subsequence
- Analysis report on production and marketing demand and investment forecast of China's PVC industry from 2021 to 2026
- What is the difference between cloud server and cloud virtual machine
- Kubernetes resource object introduction and common commands (III)
- Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code
- 1146_ SiCp learning notes_ exponentiation
- Graduation summary
- Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
猜你喜欢

TCP拥塞控制详解 | 3. 设计空间

鸿蒙第四次培训
![[error reporting] omp: error 15: initializing libiomp5md dll, but found libiomp5md. dll already initialized.](/img/a0/4fc0e0741aad2885873e60f2af3387.jpg)
[error reporting] omp: error 15: initializing libiomp5md dll, but found libiomp5md. dll already initialized.

STM32实现74HC595控制

Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method

Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code

互联网医院HIS管理平台源码,在线问诊,预约挂号 智慧医院小程序源码

Interviewer: why is the value nil not equal to nil?

Vs2013 has blocked the installer, and ie10 needs to be installed

Talk about the design and implementation logic of payment process
随机推荐
Research on Swift
Graduation summary
What is the difference between cloud server and cloud virtual machine
Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
How to read the source code [debug and observe the source code]
AcWing 3438. Number system conversion
TCP congestion control details | 3 design space
[combinatorics] recursive equation (the problem of solving recursive equation with multiple roots | the problem is raised)
Talk about the design and implementation logic of payment process
Talk about the design and implementation logic of payment process
c# .net 工具生态
Play with fancy special effects. This AE super kit is for you
Website with JS doesn't work in IE9 until the Developer Tools is activated
Remote office tools sharing | community essay solicitation
[RT thread] NXP rt10xx device driver framework -- pin construction and use
When absolutely positioned, the element is horizontally and vertically centered
Hongmeng third training
Qt调节Win屏幕亮度和声音大小
Collection of the most beautiful graduation photos in the graduation season, collection of excellent graduation photos