当前位置:网站首页>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() {
}
})
边栏推荐
- 绝对定位时元素水平垂直居中
- AcWing 4489. Longest subsequence
- Play with fancy special effects. This AE super kit is for you
- 鸿蒙第三次培训
- University of Electronic Science and technology, accounting computerization, spring 20 final exam [standard answer]
- c# .net 工具生态
- kubernetes资源对象介绍及常用命令(三)
- Assembly for unloading Loadfrom() loaded assembly - unloading the assembly loaded with assembly LoadFrom()
- Notes on problems -- watching videos on edge will make the screen green
- ES6类的继承
猜你喜欢
PS screen printing brush 131, many illustrators have followed suit
Five problems of database operation in commodity supermarket system
Leetcode 669 pruning binary search tree -- recursive method and iterative method
[set theory] order relation: summary (partial order relation | partial order set | comparable | strictly less than | covering | hasto | total order relation | quasi order relation | partial order rela
Getting started with deops
Draw some simple graphics with MFC
聊聊支付流程的设计与实现逻辑
[UE4] brush Arctic pack high quality Arctic terrain pack
[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
How to train mask r-cnn model with your own data
随机推荐
TCP congestion control details | 3 design space
[vscode] convert tabs to spaces
ArrayList分析3 : 删除元素
Comparison of kotlin collaboration + retro build network request schemes
Luogu: p2685 [tjoi2012] Bridge
Examination questions for the assignment of selected readings of British and American Literature in the course examination of Fujian Normal University in February 2022
互聯網醫院HIS管理平臺源碼,在線問診,預約掛號 智慧醫院小程序源碼
Remote office tools sharing | community essay solicitation
Leetcode13. Roman numeral to integer (three solutions)
毕业总结
IntelliJ 2021.3 short command line when running applications
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
Five problems of database operation in commodity supermarket system
Graduation summary
Implementation of Tetris in C language
Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
The gbase 8A database does not support the DB2 function value (column_name, 0) cluster syntax
远程办公工具分享|社区征文
PS screen printing brush 131, many illustrators have followed suit
c# .net 工具生态