当前位置:网站首页>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() {
}
})边栏推荐
- [RT thread] NXP rt10xx device driver framework -- RTC construction and use
- Leetcode540: a single element in an ordered array
- [combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
- PR second time
- 鸿蒙第四次培训
- List的stream中Long对象与long判等问题记录
- [combinatorics] recursive equation (the problem of solving recursive equation with multiple roots | the problem is raised)
- 【RT-Thread】nxp rt10xx 设备驱动框架之--rtc搭建和使用
- [combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th
- 一位普通程序员一天工作清单
猜你喜欢

Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source

面试官:值为 nil 为什么不等于 nil ?

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

Swm32 series Tutorial 4 port mapping and serial port application

【RT-Thread】nxp rt10xx 设备驱动框架之--Pin搭建和使用

TCP congestion control details | 3 design space

Getting started with deops

Select 3 fcpx plug-ins. Come and see if you like them

Hongmeng fourth training

Global and Chinese pediatric palliative care drug market development research and investment planning recommendations report 2022-2028
随机推荐
Global and Chinese health care OEM and ODM market status survey and investment planning recommendations report 2022-2028
QT adjust win screen brightness and sound size
自动渗透测试工具核心功能简述
IntelliJ 2021.3 short command line when running applications
一位普通程序员一天工作清单
Kubernetes resource object introduction and common commands (4)
QT学习日记9——对话框
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
Deops入门
How to purchase Google colab members in China
Leetcode540: a single element in an ordered array
List of financial products in 2022
[RT thread] construction and use of --hwtimer of NXP rt10xx device driver framework
Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
[RT thread] NXP rt10xx device driver framework -- pin construction and use
Leetcode13. Roman numeral to integer (three solutions)
Electronic Science and technology 20th autumn "Microcomputer Principle and application" online assignment 2 [standard answer]
Website with JS doesn't work in IE9 until the Developer Tools is activated
AcWing 4489. Longest subsequence
[combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th