提交 d2dc1d20 编写于 作者: DCloud_JSON's avatar DCloud_JSON

更新 自定义下拉上拉效果 模板

上级 27cdd156
...@@ -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
...@@ -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 {
} }
}, },
onLoad() { onReady() {
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);
} }
} }
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册