From b934f9f9a59e84a1af40ff139418a7d30dd68402 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期五, 07 三月 2025 17:30:34 +0800
Subject: [PATCH] =
---
src/uni_modules/uview-plus/components/u-index-list/u-index-list.vue | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/uni_modules/uview-plus/components/u-index-list/u-index-list.vue b/src/uni_modules/uview-plus/components/u-index-list/u-index-list.vue
index 44396de..eb29ec0 100644
--- a/src/uni_modules/uview-plus/components/u-index-list/u-index-list.vue
+++ b/src/uni_modules/uview-plus/components/u-index-list/u-index-list.vue
@@ -105,7 +105,7 @@
import { props } from './props';
import { mpMixin } from '../../libs/mixin/mpMixin';
import { mixin } from '../../libs/mixin/mixin';
- import { addUnit, sys, sleep, getPx } from '../../libs/function/index';
+ import { addUnit, getWindowInfo, sleep, getPx } from '../../libs/function/index';
// #ifdef APP-NVUE
// 鐢变簬weex涓洪樋閲岀殑KPI涓氱哗鑰冩牳鐨勪骇鐗╋紝鎵�浠ヤ笉鏀寔鐧惧垎姣斿崟浣嶏紝杩欓噷闇�瑕侀�氳繃dom鏌ヨ缁勪欢鐨勫搴�
@@ -152,7 +152,7 @@
// scroll-view鐨勯珮搴�
scrollViewHeight: 0,
// 绯荤粺淇℃伅
- sys: sys(),
+ sys: {},
scrolling: false,
scrollIntoView: '',
pageY: 0,
@@ -188,6 +188,7 @@
created() {
this.children = []
this.anchors = []
+ this.sys = getWindowInfo()
},
mounted() {
this.init()
@@ -320,7 +321,7 @@
const {
height
} = size
- const sysData = sys()
+ const sysData = getWindowInfo()
const windowHeight = sysData.windowHeight
let customNavHeight = 0
// 娑堥櫎鍚勭瀵艰埅鏍忛潪鍘熺敓鍜屽師鐢熷鑷寸殑宸紓锛岃绱㈠紩鍒楄〃瀛楁瘝瀵瑰睆骞曞瀭鐩村眳涓�
@@ -358,19 +359,19 @@
let index = this.currentIndex;
// 瀵笻5鐨刾ageY杩涜淇锛岃繖鏄敱浜巙ni-app鑷綔澶氭儏鍦℉5涓皢瑙︽懜鐐圭殑鍧愭爣璺烪5鐨勫鑸爮缁撳悎瀵艰嚧鐨勯棶棰�
// #ifdef H5
- // pageY += sys().windowTop
+ // pageY += getWindowInfo().windowTop
// #endif
// 瀵圭涓�鍜屾渶鍚庝竴涓瓧姣嶅仛杈圭晫澶勭悊锛屽洜涓虹敤鎴峰彲鑳藉湪瀛楁瘝鍒楄〃涓婅Е鎽稿埌涓ょ鐨勫敖澶村悗渚濈劧缁х画婊戝姩
- console.log('top1', top)
- console.log('height', height)
+ // console.log('top1', top)
+ // console.log('height', height)
top = top - (height / 2) // 鍑忓幓transfrom鐨則ranslateY鍊煎鑷寸殑楂樺害
pageY = pageY - this.topOffset
// if (this.safeBottomFix) {
// pageY = pageY + 34
// }
- console.log('topOffset', this.topOffset)
- console.log('pageY', pageY)
- console.log('top2', top)
+ // console.log('topOffset', this.topOffset)
+ // console.log('pageY', pageY)
+ // console.log('top2', top)
if (pageY < top) {
index = 0
} else if (pageY >= top + height) {
@@ -401,7 +402,7 @@
const header = await this.getHeaderRect()
// item鐨則op鍊硷紝鍦╪vue涓嬶紝妯℃嫙鍑虹殑anchor鐨則op锛岀被浼奸潪nvue涓嬬殑index-item鐨則op
let top = header.height
- console.log(top)
+ // console.log(top)
const anchors = this.anchors
// 鐢变簬list缁勪欢鏃犳硶鑾峰彇cell鐨則op鍊硷紝杩欓噷閫氳繃header slot鍜屽悇涓猧tem涔嬮棿鐨刪eight锛屾ā鎷熷嚭绫讳技闈瀗vue涓嬬殑浣嶇疆淇℃伅
let children = this.children.map((item, index) => {
@@ -426,7 +427,7 @@
// #ifdef APP-NVUE
// 鍦╪vue涓紝鐢变簬cell鍜宧eader涓哄悓绾у厓绱狅紝鎵�浠ュ疄闄呮槸闇�瑕佸header(anchor)杩涜鍋忕Щ
const anchor = `u-index-anchor-${this.uIndexList[currentIndex]}`
- console.log(anchor)
+ // console.log(anchor)
dom.scrollToElement(this.anchors[currentIndex].$refs[anchor], {
offset: 0,
animated: false
@@ -476,8 +477,8 @@
let children = this.children
// #ifdef APP-NVUE
// nvue涓嬭幏鍙栫殑婊氬姩鏉″亸绉讳负璐熸暟锛岄渶瑕佽浆涓烘鏁�
- let sys = uni.getSystemInfoSync()
- scrollTop = Math.abs(e.contentOffset.y) / 10
+ let sys = getWindowInfo()
+ scrollTop = Math.abs(e.contentOffset.y) / 10
// console.log('native', e)
// #endif
@@ -515,7 +516,7 @@
if (scrollTop <= children[0].top || scrollTop >= children[len - 1].top + children[len - 1].height) {
this.activeIndex = -1
break
- } else if (!nextItem) {
+ } else if (!nextItem) {
// 褰撲笉瀛樺湪涓嬩竴涓猧tem鏃讹紝鎰忓懗鐫�鍘嗛亶鍒颁簡鏈�鍚庝竴涓�
this.activeIndex = len - 1
break
--
Gitblit v1.9.1