当前位置:网站首页>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() {
}
})边栏推荐
- POM in idea XML graying solution
- 【JokerのZYNQ7020】DDS_ Compiler。
- Servlet specification Part II
- 聊聊支付流程的設計與實現邏輯
- 1164 Good in C
- Implementation of Tetris in C language
- [combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
- Create a new file from templates with bash script - create new file from templates with bash script
- Hongmeng fourth training
- AcWing 3438. 数制转换
猜你喜欢

Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028

Qt调节Win屏幕亮度和声音大小

STM32实现74HC595控制

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

Records of long objects and long judgments in the stream of list

Test your trained model

Hongmeng fourth training

How to train mask r-cnn model with your own data

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

面试官:值为 nil 为什么不等于 nil ?
随机推荐
Assignment examination questions of advanced English (III) for the course examination of Fujian Normal University in February 2022
Web-ui automated testing - the most complete element positioning method
AcWing 3438. 数制转换
[mathematical logic] equivalent calculus and reasoning calculus of predicate logic (individual word | predicate | quantifier | predicate logic formula | two basic formulas | proposition symbolization
ArrayList分析3 : 删除元素
Vs2013 has blocked the installer, and ie10 needs to be installed
September, 19, "cam principle and application" online assignment [Full Score answer]
[combinatorics] recursive equation (the problem of solving recursive equation with multiple roots | the problem is raised)
AcWing 4489. Longest subsequence
Golang unit test, mock test and benchmark test
Luogu: p1155 [noip2008 improvement group] double stack sorting (bipartite graph, simulation)
Qt调节Win屏幕亮度和声音大小
Interviewer: why is the value nil not equal to nil?
Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
When absolutely positioned, the element is horizontally and vertically centered
Kubernetes resource object introduction and common commands (4)
Loop through JSON object list
Five problems of database operation in commodity supermarket system
How to purchase Google colab members in China
Assembly for unloading Loadfrom() loaded assembly - unloading the assembly loaded with assembly LoadFrom()