当前位置:网站首页>Tiktok practice ~ homepage video ~ pull-down refresh
Tiktok practice ~ homepage video ~ pull-down refresh
2022-06-26 19:06:00 【gblfy】
List of articles
1. Configure drop-down refresh
stay pages.json
Add the following configuration to the configuration file :
"enablePullDownRefresh":true // Turn on pull-down refresh
2. Pull down refresh monitor
// Current page pull-down refresh
onPullDownRefresh() {
var me = this;
// monitor tab
console.log("me.curIndex",me.curIndex)
// Pull down refresh judgment , If it's different tab, The refresh request in the component is also different
if (me.curIndex == 0) {
// Leave a seat vacant for sb.
} else if (me.curIndex == 1) {
// Call the public video component to query the short video list on the home page
this.$refs.videoFollowComp.displayVideoPaging(1, true);
} else if (me.curIndex == 2) {
// Call the public video component to query the short video list on the home page
this.$refs.videoComp.displayVideoPaging(1, true);
}
}
3. tab Listening index
tab page | Listen to the current index method | Get listening api | Indexes |
---|---|---|---|
near | onPullDownRefresh | me.curInde | 0 |
Focus on | onPullDownRefresh | me.curInde | 1 |
recommend | onPullDownRefresh | me.curInde | 2 |
4. Console monitoring
5. Parent and child components call
- Parent page index.nvue
this.$refs.videoFollowComp.displayVideoPaging(1, true);
- Child components videoComp.vue
// Paging query NEW list, And append to existing list in
displayVideoPaging(page, needClearList) {
// Query the list of short videos on the home page
var me = this;
var myUserInfo = getApp().getUserInfoSession();
// console.log(" home page ",myUserInfo)
var userId = "";
if (myUserInfo != null) {
userId = myUserInfo.id;
}
var serverUrl = app.globalData.serverUrl;
uni.request({
method: "GET",
header: {
headerUserId: userId,
headerUserToken: app.getUserSessionToken()
},
url: serverUrl + "/vlog/indexList?userId=" + userId + "&page=" + page + "&pageSize=10",
success(result) {
if (result.data.status == 200) {
var vlogList = result.data.data.rows;
var totalPage = result.data.data.total;
// me.playerList = vlogList;
if (needClearList) {
me.playerList = [];
}
me.playerList = me.playerList.concat(vlogList);
me.page = page;
me.totalPage = totalPage;
if (needClearList) {
me.setThisVlogInfo();
me.freshCommentCounts();
}
} else {
uni.showToast({
title: result.data.msg,
icon: "none",
duration: 3000
});
}
},
complete() {
uni.stopPullDownRefresh();
}
});
}
6. design sketch
边栏推荐
猜你喜欢
品达通用权限系统(Day 1~Day 2)
ARM裸板调试之串口打印及栈初步分析
抖音实战~搜索页面~扫描二维码
wm_ Concat() and group_ Concat() function
Do you know how to compare two objects
Project practice 6: distributed transaction Seata
Web resource preloading - production environment practice
Unit test of boot
Clion编译catkin_ws(ROS工作空间包的简称)加载CMakeLists.txt出现的问题
mysql的充值问题
随机推荐
stm32和电机开发(直流有刷电机和步进电机)
Several delete operations in SQL
Using cache in vuex to solve the problem of data loss in refreshing state
Some basic mistakes
几种常见的UML关系图汇总
Feign remote call
Redis single sign on system + voting system
Unit test of boot
vuex中利用缓存解决刷新state数据丢失问题
项目实战五:搭建ELk日志收集系统
Boyun, standing at the forefront of China's container industry
Redis单点登陆系统+投票系统
Redis Basics
Boot的单元测试
Basic and necessary common plug-ins of vscade
Take you to resolve hash conflicts and implement a simple hash table,
关于不等式取值转义的思路
To: seek truth from facts
redis 基础知识
mysql的充值问题