hookehuyr

refactor(Dashboard): 使用更简洁的Taro.getWindowInfo替换getSystemInfo

简化滚动触发逻辑,直接获取窗口高度信息,移除不必要的回调嵌套
<!--
* @Date: 2025-08-27 17:43:45
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-10-25 20:05:09
* @LastEditTime: 2025-10-26 20:16:05
* @FilePath: /lls_program/src/pages/Dashboard/index.vue
* @Description: 首页
-->
......@@ -657,21 +657,14 @@ const handlePageScroll = (scrollTop) => {
if (rect) {
// console.log('RankingCard 位置信息:', rect)
// 获取系统信息
Taro.getSystemInfo({
success: (res) => {
const windowHeight = res.windowHeight
const { windowHeight } = Taro.getWindowInfo();
// 当组件顶部进入视窗下方80%位置时触发
const triggerPoint = windowHeight * 0.8
// console.log('窗口高度:', windowHeight, '触发点:', triggerPoint, 'rect.top:', rect.top)
const triggerPoint = windowHeight * 0.8;
if (rect.top <= triggerPoint && rect.bottom >= 0) {
// console.log('触发数字滚动动画!')
// 触发数字滚动动画
triggerNumberRoll()
}
}
})
} else {
console.log('未找到 RankingCard 容器元素')
}
......