fix:对接高德地图,修复地图bug
This commit is contained in:
+20
-11
@@ -248,17 +248,26 @@ class OrderMonitor {
|
||||
// 导出单例实例
|
||||
export const orderMonitor = new OrderMonitor()
|
||||
|
||||
// 监听页面切换事件
|
||||
uni.onAppRoute((route) => {
|
||||
const pagePath = route.path || ''
|
||||
const pageSegments = pagePath.split('/')
|
||||
const pageName = pageSegments[pageSegments.length - 1]
|
||||
|
||||
// 设置当前活跃页面
|
||||
orderMonitor.setActivePage(pageName || null)
|
||||
|
||||
console.log('页面切换:', pagePath, '当前活跃页面:', pageName)
|
||||
})
|
||||
// 监听页面切换事件(仅微信小程序支持)
|
||||
// #ifdef MP-WEIXIN
|
||||
if (typeof uni.onAppRoute === 'function') {
|
||||
uni.onAppRoute((route) => {
|
||||
const pagePath = route.path || ''
|
||||
const pageSegments = pagePath.split('/')
|
||||
const pageName = pageSegments[pageSegments.length - 1]
|
||||
|
||||
// 设置当前活跃页面
|
||||
orderMonitor.setActivePage(pageName || null)
|
||||
|
||||
console.log('页面切换:', pagePath, '当前活跃页面:', pageName)
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-ALIPAY
|
||||
// 支付宝小程序不支持 onAppRoute,通过页面生命周期手动设置
|
||||
// 各个页面需要在 onShow 中调用 orderMonitor.setActivePage()
|
||||
// #endif
|
||||
|
||||
// 页面加载时自动恢复监控上次的活跃订单(如果有)
|
||||
const initOrderMonitor = () => {
|
||||
|
||||
Reference in New Issue
Block a user