当前位置:网站首页>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() {
}
})
边栏推荐
- Notes on problems -- watching videos on edge will make the screen green
- [RT thread] NXP rt10xx device driver framework -- RTC construction and use
- Golang单元测试、Mock测试以及基准测试
- 1147_ Makefile learning_ Target files and dependent files in makefile
- Tensorboard quick start (pytoch uses tensorboard)
- Financial management (Higher Vocational College) financial management online Assignment 1 in autumn 20
- 聊聊支付流程的设计与实现逻辑
- 数学公式(测试)
- UE4 official charging resources, with a total price of several thousand
- [RT thread] NXP rt10xx device driver framework -- pin construction and use
猜你喜欢
Collection of the most beautiful graduation photos in the graduation season, collection of excellent graduation photos
1146_ SiCp learning notes_ exponentiation
Golang unit test, mock test and benchmark test
Research Report on investment trends and development planning of China's thermal insulation material industry, 2022-2028
面试官:值为 nil 为什么不等于 nil ?
How to train mask r-cnn model with your own data
国内如何购买Google Colab会员
Leetcode Valentine's Day Special - looking for a single dog
IntelliJ 2021.3 short command line when running applications
SQL injection database operation foundation
随机推荐
RDS数据库的监测页面在哪看?
[combinatorics] recursive equation (the non-homogeneous part is an exponential function and the bottom is the characteristic root | example of finding a special solution)
Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
POM in idea XML graying solution
Golang单元测试、Mock测试以及基准测试
面试官:值为 nil 为什么不等于 nil ?
MinGW compile boost library
kubernetes资源对象介绍及常用命令(五)-(NFS&PV&PVC)
Leetcode 108 converts an ordered array into a binary search tree -- recursive method
Leetcode 669 pruning binary search tree -- recursive method and iterative method
AcWing 4489. Longest subsequence
Examination questions for the assignment of selected readings of British and American Literature in the course examination of Fujian Normal University in February 2022
[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
List的stream中Long对象与long判等问题记录
[UE4] brush Arctic pack high quality Arctic terrain pack
Investigation on the operation prospect of the global and Chinese Anti enkephalinase market and analysis report on the investment strategy of the 14th five year plan 2022-2028
Vs2013 has blocked the installer, and ie10 needs to be installed
一入“远程”终不悔,几人欢喜几人愁。| 社区征文
Leetcode540: a single element in an ordered array
How to train mask r-cnn model with your own data