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

边栏推荐
- 自己创建一个时间拦截器
- Feign remote call
- 50 lines of code to crawl TOP500 books and import TXT documents
- ROS query topic specific content common instructions
- Nftgamefi chain game system development detailed solution - chain game system development principle analysis
- Numpy's Matplotlib
- Using cache in vuex to solve the problem of data loss in refreshing state
- 手机影像内卷几时休?
- NFTGameFi链游系统开发详解方案丨链游系统开发原理解析
- Enter n integers and output the number of occurrences greater than or equal to half the length of the array
猜你喜欢
随机推荐
PC端录制扫515地机器人/scan数据
Decompilation of zero time technology smart contract security series articles
自己创建一个时间拦截器
项目实战四:用户登录及token访问验证(reids+jwt)
(multi threading knowledge points that must be mastered) understand threads, create threads, common methods and properties of using threads, and the meaning of thread state and state transition
转:苹果CEO库克:伟大的想法来自不断拒绝接受现状
Interview key points that must be mastered index and affairs (with B-tree and b+ tree)
Union, intersection and difference operations in SQL
Kubernetes resource topology aware scheduling optimization
Chain game development finished product source code chain game system development details
最小生成树、最短路径、拓扑排序、关键路径
IK分词器
(树) 树状数组
Project practice 5: build elk log collection system
JS mobile terminal touch screen event
Comparing the size relationship between two objects turns out to be so fancy
Usage and difference between ros:: spinonce() and ros:: spin()
Why don't I recommend going to sap training institution for training?
Leetcode 128 longest continuous sequence
vuex中利用缓存解决刷新state数据丢失问题









