完成consumer端同步

This commit is contained in:
2026-05-14 15:28:09 +08:00
parent 612fb3d360
commit 0ffbc53902
197 changed files with 92657 additions and 7564 deletions

View File

@@ -281,11 +281,12 @@ function openContextMenu(e: MouseEvent, tab: TabItem) {
menuY.value = e.clientY
// 边缘检测
if (menuX.value + 120 > window.innerWidth) {
menuX.value = window.innerWidth - 130
const _winInfo = uni.getWindowInfo()
if (menuX.value + 120 > _winInfo.windowWidth) {
menuX.value = _winInfo.windowWidth - 130
}
if (menuY.value + 140 > window.innerHeight) {
menuY.value = window.innerHeight - 150
if (menuY.value + 140 > _winInfo.windowHeight) {
menuY.value = _winInfo.windowHeight - 150
}
// 关闭功能菜单,显示右键菜单
@@ -370,8 +371,8 @@ function toggleFunctionMenu(e?: any): void {
*/
function onScroll(e: any): void {
if (e && e.detail) {
scrollLeft.value = e.detail.scrollLeft || 0
scrollWidth.value = e.detail.scrollWidth || 0
scrollLeft.value = e.detail.scrollLeft != null ? e.detail.scrollLeft : 0
scrollWidth.value = e.detail.scrollWidth != null ? e.detail.scrollWidth : 0
clientWidth.value = e.detail.scrollWidth ? (e.detail.scrollWidth - e.detail.scrollLeft) : 0
}
checkScrollBounds()
@@ -509,11 +510,18 @@ watch(() => props.tabs.length, () => {
onMounted(() => {
// 监听全局点击关闭菜单
// #ifdef H5
window.addEventListener('click', closeAllMenus)
// #endif
// 监听窗口大小变化
// #ifdef H5
window.removeEventListener('resize', updateScrollInfo) // 防重复
window.addEventListener('resize', updateScrollInfo)
// #endif
// #ifndef H5
uni.onWindowResize(updateScrollInfo)
// #endif
// 初始化滚动信息 - 延迟确保DOM渲染完成
setTimeout(() => {
@@ -528,8 +536,13 @@ onMounted(() => {
})
onUnmounted(() => {
// #ifdef H5
window.removeEventListener('click', closeAllMenus)
window.removeEventListener('resize', updateScrollInfo)
// #endif
// #ifndef H5
uni.offWindowResize(updateScrollInfo)
// #endif
// 清理功能菜单定时器
if (hideFunctionMenuTimer !== null) {