Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
d2dc1d20
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6006
Star
91
Fork
164
代码
文件
提交
分支
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看板
提交
d2dc1d20
编写于
8月 02, 2023
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新 自定义下拉上拉效果 模板
上级
27cdd156
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
61 addition
and
57 deletion
+61
-57
pages.json
pages.json
+24
-21
pages/template/custom-pull-page/custom-pull-page.uvue
pages/template/custom-pull-page/custom-pull-page.uvue
+19
-21
pages/template/custom-pull-page/custom-pull/custom-pull.uvue
pages/template/custom-pull-page/custom-pull/custom-pull.uvue
+18
-15
未找到文件。
pages.json
浏览文件 @
d2dc1d20
...
@@ -658,7 +658,7 @@
...
@@ -658,7 +658,7 @@
"path"
:
"pages/template/scroll-fold-nav/scroll-fold-nav"
,
"path"
:
"pages/template/scroll-fold-nav/scroll-fold-nav"
,
"style"
:
{
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
"navigationBarTextStyle"
:
"black"
"navigationBarTextStyle"
:
"black"
}
}
},
},
{
{
...
@@ -689,16 +689,22 @@
...
@@ -689,16 +689,22 @@
{
{
"path"
:
"pages/template/scroll-fold-nav2/scroll-fold-nav2"
,
"path"
:
"pages/template/scroll-fold-nav2/scroll-fold-nav2"
,
"style"
:
{
"style"
:
{
"navigationStyle"
:
"custom"
"navigationStyle"
:
"custom"
,
"navigationBarTextStyle"
:
"black"
}
}
},
},
{
{
"path"
:
"pages/template/calendar/calendar"
,
"path"
:
"pages/template/calendar/calendar"
,
"style"
:
"style"
:
{
{
"navigationBarTitleText"
:
"日历"
,
"navigationBarTitleText"
:
"日历"
,
"enablePullDownRefresh"
:
false
"enablePullDownRefresh"
:
false
}
}
},
{
"path"
:
"pages/template/custom-refresher/custom-refresher"
,
"style"
:
{
"navigationBarTitleText"
:
"自定义下拉刷新(原生实现)"
,
"enablePullDownRefresh"
:
false
}
}
}
],
],
"globalStyle"
:
{
"globalStyle"
:
{
...
@@ -715,8 +721,7 @@
...
@@ -715,8 +721,7 @@
"selectedColor"
:
"#007AFF"
,
"selectedColor"
:
"#007AFF"
,
"borderStyle"
:
"black"
,
"borderStyle"
:
"black"
,
"backgroundColor"
:
"#F8F8F8"
,
"backgroundColor"
:
"#F8F8F8"
,
"list"
:
[
"list"
:
[{
{
"pagePath"
:
"pages/tabBar/component"
,
"pagePath"
:
"pages/tabBar/component"
,
"iconPath"
:
"static/component.png"
,
"iconPath"
:
"static/component.png"
,
"selectedIconPath"
:
"static/componentHL.png"
,
"selectedIconPath"
:
"static/componentHL.png"
,
...
@@ -745,12 +750,10 @@
...
@@ -745,12 +750,10 @@
"condition"
:
{
"condition"
:
{
//模式配置,仅开发期间生效
//模式配置,仅开发期间生效
"current"
:
0
,
//当前激活的模式(list
的索引项)
"current"
:
0
,
//当前激活的模式(list
的索引项)
"list"
:
[
"list"
:
[{
{
"name"
:
""
,
//模式名称
"name"
:
""
,
//模式名称
"path"
:
""
,
//启动页面,必选
"path"
:
""
,
//启动页面,必选
"query"
:
""
//启动参数,在页面的onLoad函数里面得到
"query"
:
""
//启动参数,在页面的onLoad函数里面得到
}
}]
]
}
}
}
}
\ No newline at end of file
pages/template/custom-pull-page/custom-pull-page.uvue
浏览文件 @
d2dc1d20
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
<view class="root">
<view class="root">
<view class="top-box">
<view class="top-box">
<text class="top-box-text">可通过slot自定义,上拉加载下来刷新效果示例</text>
<text class="top-box-text">可通过slot自定义,上拉加载下来刷新效果示例</text>
<text class="top-box-text">已知问题:因不支持通过ref 调用组件内的方法,本示例在下拉触发刷新方法时,1秒后“组件内”直接调用刷新完成接口,上拉加载同理。后续会修复</text>
</view>
</view>
<custom-pull :height="300" width="750rpx" :refreshBoxHeight="60" :refreshThreshold="60" :refreshHoldHeight="60"
<custom-pull :height="300" width="750rpx" :refreshBoxHeight="60" :refreshThreshold="60" :refreshHoldHeight="60"
...
@@ -11,7 +10,7 @@
...
@@ -11,7 +10,7 @@
<template v-slot:refresh-box="scope">
<template v-slot:refresh-box="scope">
<view class="refresh-box">
<view class="refresh-box">
<image class="logo" src="/static/
logo
.png" mode="widthFix"></image>
<image class="logo" src="/static/
uni
.png" mode="widthFix"></image>
<text class="tip-text" v-if="scope.get('refreshState')== 0">继续下拉执行刷新(slot)</text>
<text class="tip-text" v-if="scope.get('refreshState')== 0">继续下拉执行刷新(slot)</text>
<text class="tip-text" v-if="scope.get('refreshState')== 1">释放立即刷新</text>
<text class="tip-text" v-if="scope.get('refreshState')== 1">释放立即刷新</text>
<text class="tip-text" v-if="scope.get('refreshState')== 2">刷新中</text>
<text class="tip-text" v-if="scope.get('refreshState')== 2">刷新中</text>
...
@@ -21,7 +20,6 @@
...
@@ -21,7 +20,6 @@
</view>
</view>
</template>
</template>
<view v-for="i in 8" class="item">
<view v-for="i in 8" class="item">
item-{{i}}
item-{{i}}
</view>
</view>
...
@@ -53,18 +51,18 @@
...
@@ -53,18 +51,18 @@
return {
return {
}
}
},
},
on
Load
() {
on
Ready
() {
console.log('this.$refs["custom-pull"]', this.$refs["custom-pull"]
);
// console.log('this.$refs["custom-pull"]', this.$refs["custom-pull"] as ComponentPublicInstance
);
},
},
methods: {
methods: {
loading() {
loading() {
setTimeout(() => {
setTimeout(() => {
// this.$refs["custom-pull"].endLoading() //暂不支持,内部模拟实现
(this.$refs["custom-pull"] as ComponentPublicInstance).$callMethod('endLoading')
}, 1000);
}, 1000);
},
},
refresh() {
refresh() {
setTimeout(() => {
setTimeout(() => {
// this.$refs["custom-pull"].endRefresh() //暂不支持,内部模拟实现
(this.$refs["custom-pull"] as ComponentPublicInstance).$callMethod('endRefresh')
}, 1000);
}, 1000);
}
}
}
}
...
...
pages/template/custom-pull-page/custom-pull/custom-pull.uvue
浏览文件 @
d2dc1d20
...
@@ -94,11 +94,13 @@
...
@@ -94,11 +94,13 @@
},
},
touchmove(e : TouchEvent) {
touchmove(e : TouchEvent) {
if (
if (
// 滚动条不在顶部,也不是触底
!(
scrollTop != 0 && !this.scrollInBottom ||
(scrollTop == 0 && this.refreshState == 0) ||
// 正在刷新中,或者加载更多中
(this.scrollInBottom == true && this.loadingState == 0)
this.refreshState != 0 && this.loadingState != 0
)
) {
) {
// console.log('this.scrollInBottom == true && this.loadingState == 0')
// console.log(this.scrollInBottom,this.loadingState)
return
return
}
}
...
@@ -150,9 +152,12 @@
...
@@ -150,9 +152,12 @@
}
}
},
},
onScroll(e : ScrollEvent) {
onScroll(e : ScrollEvent) {
console.log('ScrollViewScroll-currentTarget', e.currentTarget);
// console.log('ScrollEvent-currentTarget', e.currentTarget);
scrollTop = e.detail.scrollTop
// console.log('e.detail.scrollTop',Math.floor(e.detail.scrollTop));
this.scrollInBottom = (scrollTop + this.height) == e.detail.scrollHeight
scrollTop = Math.floor(e.detail.scrollTop)
// console.log('(scrollTop + this.height) == e.detail.scrollHeight',(scrollTop + this.height) == e.detail.scrollHeight)
// console.log('(scrollTop + this.height) == e.detail.scrollHeight',scrollTop,this.height,e.detail.scrollHeight)
this.scrollInBottom = (scrollTop + this.height) == Math.floor(e.detail.scrollHeight)
},
},
endRefresh() {
endRefresh() {
this.refreshState = 3
this.refreshState = 3
...
@@ -173,9 +178,7 @@
...
@@ -173,9 +178,7 @@
</script>
</script>
<style scoped>
<style scoped>
.pull-box-root {
.pull-box-root {}
}
.pull-box {}
.pull-box {}
/* .loading-box {
/* .loading-box {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录