当前位置:网站首页>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() {
}
})边栏推荐
- Automata and automatic line of non-standard design
- How to train mask r-cnn model with your own data
- WEB-UI自动化测试-最全元素定位方法
- Talk about the design and implementation logic of payment process
- Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
- Mathematical formula (test)
- STM32实现74HC595控制
- i++与++i的区别:通俗易懂的讲述他们的区别
- Wechat applet for the first time
- Baiwen.com 7 days Internet of things smart home learning experience punch in the next day
猜你喜欢

Automata and automatic line of non-standard design

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

UE4 official charging resources, with a total price of several thousand

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

Collection of the most beautiful graduation photos in the graduation season, collection of excellent graduation photos

POM in idea XML graying solution

Test your trained model

PS screen printing brush 131, many illustrators have followed suit

Golang unit test, mock test and benchmark test

Implementation of Tetris in C language
随机推荐
Where is the database account used when running SQL tasks in data warehouse tasks configured
1146_ SiCp learning notes_ exponentiation
[combinatorics] generating function (linear property | product property)
What is the difference between cloud server and cloud virtual machine
1147_ Makefile learning_ Target files and dependent files in makefile
RDS数据库的监测页面在哪看?
AcWing 4489. Longest subsequence
Deops入门
Swm32 series Tutorial 4 port mapping and serial port application
Electronic technology 20th autumn "Introduction to machine manufacturing" online assignment 3 [standard answer]
互联网医院HIS管理平台源码,在线问诊,预约挂号 智慧医院小程序源码
微服务组件Sentinel控制台调用
MinGW compile boost library
1164 Good in C
鸿蒙第四次培训
Examination questions for the assignment of selected readings of British and American Literature in the course examination of Fujian Normal University in February 2022
STM32 realizes 74HC595 control
POM in idea XML graying solution
Select 3 fcpx plug-ins. Come and see if you like them
Graduation summary