Showing
1 changed file
with
8 additions
and
11 deletions
| 1 | import lottie, { AnimationItem } from '@ohos/lottie'; | 1 | import lottie, { AnimationItem } from '@ohos/lottie'; |
| 2 | +import { RefreshConstants } from '../../utils/RefreshConstants'; | ||
| 2 | import { LoadStatus, RefreshLayoutBean } from './RefreshLayoutBean'; | 3 | import { LoadStatus, RefreshLayoutBean } from './RefreshLayoutBean'; |
| 3 | 4 | ||
| 4 | /** | 5 | /** |
| @@ -122,8 +123,7 @@ export default struct CustomLayout { | @@ -122,8 +123,7 @@ export default struct CustomLayout { | ||
| 122 | if (!this.refreshBean.isVisible) { | 123 | if (!this.refreshBean.isVisible) { |
| 123 | return | 124 | return |
| 124 | } | 125 | } |
| 125 | - let maxH = CustomLayout.REFRESH_HEIGHT | ||
| 126 | - let tmpHeight = this.refreshBean.offset > maxH ? maxH : this.refreshBean.offset | 126 | + |
| 127 | if (this.refreshBean.loadStatus === LoadStatus.PRELOAD) { | 127 | if (this.refreshBean.loadStatus === LoadStatus.PRELOAD) { |
| 128 | // 下拉刷新 | 128 | // 下拉刷新 |
| 129 | this.animate1(this.refreshBean.offset) | 129 | this.animate1(this.refreshBean.offset) |
| @@ -132,19 +132,16 @@ export default struct CustomLayout { | @@ -132,19 +132,16 @@ export default struct CustomLayout { | ||
| 132 | this.animate2() | 132 | this.animate2() |
| 133 | }else if (this.refreshBean.loadStatus == LoadStatus.GOLOADED) { | 133 | }else if (this.refreshBean.loadStatus == LoadStatus.GOLOADED) { |
| 134 | this.textVisible = true | 134 | this.textVisible = true |
| 135 | - if (tmpHeight <= 0) { | ||
| 136 | - setTimeout(() => { | ||
| 137 | - // 延时设置0,让“已更新到最新”展示 | ||
| 138 | - this.textVisible = false | ||
| 139 | - this.setHeight0WithAnimation() | ||
| 140 | - }, 800) | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | } else { | 135 | } else { |
| 144 | // 刷新完成 | 136 | // 刷新完成 |
| 145 | !!this.animateItem && lottie.destroy(this.animateName) | 137 | !!this.animateItem && lottie.destroy(this.animateName) |
| 146 | !!this.animateItem2 && lottie.destroy(this.animateName2) | 138 | !!this.animateItem2 && lottie.destroy(this.animateName2) |
| 139 | + | ||
| 140 | + this.textVisible = false | ||
| 141 | + this.setHeight0WithAnimation() | ||
| 147 | } | 142 | } |
| 143 | + let maxH = CustomLayout.REFRESH_HEIGHT | ||
| 144 | + let tmpHeight = this.refreshBean.offset > maxH ? maxH : this.refreshBean.offset | ||
| 148 | if (this.refreshBean.loadStatus === LoadStatus.LOADED) { | 145 | if (this.refreshBean.loadStatus === LoadStatus.LOADED) { |
| 149 | 146 | ||
| 150 | } else { | 147 | } else { |
| @@ -159,7 +156,7 @@ export default struct CustomLayout { | @@ -159,7 +156,7 @@ export default struct CustomLayout { | ||
| 159 | setHeight0WithAnimation() { | 156 | setHeight0WithAnimation() { |
| 160 | // this.layoutHeight = 0 | 157 | // this.layoutHeight = 0 |
| 161 | animateTo({ | 158 | animateTo({ |
| 162 | - duration: 500, // 动画时长 | 159 | + duration: 300, // 动画时长 |
| 163 | curve: Curve.Linear, // 动画曲线 | 160 | curve: Curve.Linear, // 动画曲线 |
| 164 | iterations: 1, // 播放次数 | 161 | iterations: 1, // 播放次数 |
| 165 | playMode: PlayMode.Normal, // 动画模式 | 162 | playMode: PlayMode.Normal, // 动画模式 |
-
Please register or login to post a comment