Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
27cdd156
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
27cdd156
编写于
8月 02, 2023
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增 scroll-view下拉刷新示例
上级
25828a0c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
132 addition
and
4 deletion
+132
-4
pages/tabBar/template.uvue
pages/tabBar/template.uvue
+16
-4
pages/template/custom-refresher/custom-refresher.uvue
pages/template/custom-refresher/custom-refresher.uvue
+70
-0
pages/template/custom-refresher/refresh-box/refresh-box.uvue
pages/template/custom-refresher/refresh-box/refresh-box.uvue
+46
-0
未找到文件。
pages/tabBar/template.uvue
浏览文件 @
27cdd156
...
...
@@ -52,10 +52,16 @@
open: false,
enable: false,
pages: [] as Page[]
},{
id: "scroll-fold-nav",
url: "scroll-fold-nav",
name: "随滚动折叠的导航栏",
open: false,
pages: [] as Page[]
},{
id: "scroll-fold-nav2",
url: "scroll-fold-nav2",
name: "随滚动折叠的导航栏",
name: "随滚动折叠的导航栏
2
",
open: false,
pages: [] as Page[]
}, {
...
...
@@ -67,12 +73,18 @@
pages: [] as Page[]
}, {
id: "custom-
pull-page
",
id: "custom-
refresher
",
url: "custom-pull-page",
name: "自定义上拉下拉效果",
name: "自定义上拉下拉效果
(前端实现)
",
open: false,
pages: [] as Page[]
},
},{
id: "custom-refresher",
url: "custom-refresher",
name: "自定义下拉刷新(原生实现)",
open: false,
pages: [] as Page[]
},
{
id: "pull-zoom-image",
url: "pull-zoom-image",
...
...
pages/template/custom-refresher/custom-refresher.uvue
0 → 100644
浏览文件 @
27cdd156
<template>
<view>
<scroll-view class="scroll-view"
:refresher-enabled="true" :refresher-triggered="refresherTriggered" refresher-default-style="none"
@refresherpulling="onRefresherpulling"
@refresherrefresh="onRefresherrefresh"
:refresher-threshold="refresherThreshold"
>
<view v-for="i in 7" class="item">
item-{{i}}
</view>
<refresh-box slot="refresher" :state="state" :pullingDistance="pullingDistance"></refresh-box>
</scroll-view>
</view>
</template>
<script>
import RefresherEvent from 'io.dcloud.uniapp.runtime.RefresherEvent';
import refreshBox from './refresh-box/refresh-box.uvue';
export default {
components:{refreshBox},
data() {
return {
refresherTriggered:false,
refresherThreshold:40,
pullingDistance:0
}
},
computed:{
state():number{
if(this.refresherTriggered){
return 2
}
if(this.pullingDistance > this.refresherThreshold){
return 1
}else{
return 0
}
}
},
methods: {
onRefresherpulling(e:RefresherEvent){
// console.log('onRefresherpulling',e.detail.dy)
this.pullingDistance = e.detail.dy
},
onRefresherrefresh(){
this.refresherTriggered = true
setTimeout(()=>{
this.refresherTriggered = false
},1000)
},
// onRefresherrestore(e:RefresherEvent){
// console.log('onRefresherrestore',e)
// },
// onRefresherabort(e:RefresherEvent){
// console.log('onRefresherabort',e)
// },
}
}
</script>
<style>
.scroll-view {
flex: 1;
}
.item {
height: 80px;
justify-content: center;
}
</style>
\ No newline at end of file
pages/template/custom-refresher/refresh-box/refresh-box.uvue
0 → 100644
浏览文件 @
27cdd156
<template>
<view>
<view slot="refresher" class="refresh-box">
<image class="logo" src="/static/uni.png" mode="widthFix"></image>
<text class="tip-text">{{text[state]}}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
text: ['继续下拉执行刷新', '释放立即刷新', '刷新中...']
}
},
props: {
state: {
type: Number,
default: 0
},
methods: {
}
}
}
</script>
<style>
.refresh-box {
justify-content: center;
align-items: center;
}
.logo {
width: 30px;
height: 30px;
margin-top: 3px;
}
.tip-text {
color: #888;
font-size: 12px;
padding: 2px 0;
}
</style>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录