当前位置:网站首页>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

边栏推荐
- 项目实战五:搭建ELk日志收集系统
- 手机影像内卷几时休?
- Logstash安装及使用
- The eigen library calculates the angle between two vectors
- Filebeat安装及使用
- Interview key points that must be mastered index and affairs (with B-tree and b+ tree)
- Solidity - contract inheritance sub contract contains constructor errors and one contract calls the view function of another contract to charge gas fees
- On the escape of inequality value
- wm_ Concat() and group_ Concat() function
- 抖音实战~分享模块~短视频下载(保存到相册)
猜你喜欢

9. Intelligent transportation project (2)

SSO微服务工程中用户行为日志的记录

Commodity seckill system

品达通用权限系统(Day 1~Day 2)

Wechat applet uniapp left slide delete with Delete Icon

黑客用机器学习发动攻击的九种方法

Leetcode 128 longest continuous sequence

uni-app使用canvas绘制二维码

抖音实战~搜索页面~视频详情

Minimum spanning tree, shortest path, topology sorting, critical path
随机推荐
To: Apple CEO Cook: great ideas come from constantly rejecting the status quo
Successfully solved the problem of garbled microservice @value obtaining configuration file
Development principle analysis and source code of dapp-lp single and dual currency liquidity pledge mining system
uni-app使用canvas绘制二维码
Installation and use of logstash
Minimum spanning tree, shortest path, topology sorting, critical path
The goal you specified requires a project to execute but there is no POM
JSONUtils工具类(基于alibaba fastjson)
ARM裸板调试之串口打印及栈初步分析
Vscode 基础必备 常用插件
Several delete operations in SQL
Clion breakpoint single step debugging
50行代码爬取Top500图书导入TXT文档
MySQL recharge
Pinda general permission system (day 1~day 2)
Redis single sign on system + voting system
Example of using QPushButton style (and method of adding drop-down menu to button SetMenu)
软考备战多媒体系统
String string is converted to jsonarray and parsed
【Kubernetes】Kubernetes 原理剖析与实战应用(更新中)