wangliang_wd

feat:优化下拉刷新展示

import lottie, { AnimationItem } from '@ohos/lottie';
import { RefreshConstants } from '../../utils/RefreshConstants';
import { LoadStatus, RefreshLayoutBean } from './RefreshLayoutBean';
/**
... ... @@ -122,8 +123,7 @@ export default struct CustomLayout {
if (!this.refreshBean.isVisible) {
return
}
let maxH = CustomLayout.REFRESH_HEIGHT
let tmpHeight = this.refreshBean.offset > maxH ? maxH : this.refreshBean.offset
if (this.refreshBean.loadStatus === LoadStatus.PRELOAD) {
// 下拉刷新
this.animate1(this.refreshBean.offset)
... ... @@ -132,19 +132,16 @@ export default struct CustomLayout {
this.animate2()
}else if (this.refreshBean.loadStatus == LoadStatus.GOLOADED) {
this.textVisible = true
if (tmpHeight <= 0) {
setTimeout(() => {
// 延时设置0,让“已更新到最新”展示
this.textVisible = false
this.setHeight0WithAnimation()
}, 800)
}
} else {
// 刷新完成
!!this.animateItem && lottie.destroy(this.animateName)
!!this.animateItem2 && lottie.destroy(this.animateName2)
this.textVisible = false
this.setHeight0WithAnimation()
}
let maxH = CustomLayout.REFRESH_HEIGHT
let tmpHeight = this.refreshBean.offset > maxH ? maxH : this.refreshBean.offset
if (this.refreshBean.loadStatus === LoadStatus.LOADED) {
} else {
... ... @@ -159,7 +156,7 @@ export default struct CustomLayout {
setHeight0WithAnimation() {
// this.layoutHeight = 0
animateTo({
duration: 500, // 动画时长
duration: 300, // 动画时长
curve: Curve.Linear, // 动画曲线
iterations: 1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
... ...