提交 194ab6fb 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

perf(uts web): 优化页面切换时关闭交互弹框逻辑

上级 e85ff5ba
......@@ -7,9 +7,21 @@ import {
createMemoryHistory,
} from 'vue-router'
import { getCurrentPages, normalizeRouteKey, removePage } from '../setup/page'
//#if _X_
import { hideActionSheet } from '../../service/api/ui/popup/showActionSheet'
import { hideModal } from '../../service/api/ui/popup/showModal'
//#endif
export function initRouter(app: App) {
const router = createRouter(createRouterOptions())
//#if _X_
router.beforeEach((to, from) => {
hideActionSheet()
hideModal()
uni.hideToast()
uni.hideLoading()
})
//#endif
;(app as any).router = router // 挂在app上,方便ssr获取
app.use(router)
}
......
......@@ -7,10 +7,6 @@ import {
NavigateBackProtocol,
} from '@dcloudio/uni-api'
import { ON_BACK_PRESS } from '@dcloudio/uni-shared'
//#if _X_
import { hideActionSheet } from '../ui/popup/showActionSheet'
import { hideModal } from '../ui/popup/showModal'
//#endif
export const navigateBack = defineAsyncApi<API_TYPE_NAVIGATE_BACK>(
API_NAVIGATE_BACK,
......@@ -26,12 +22,6 @@ export const navigateBack = defineAsyncApi<API_TYPE_NAVIGATE_BACK>(
if (!canBack) {
return reject(ON_BACK_PRESS)
}
//#if _X_
hideActionSheet()
hideModal()
uni.hideToast()
uni.hideLoading()
//#endif
getApp().$router.go(-args!.delta!)
return resolve()
......
import { EventChannel, parseUrl } from '@dcloudio/uni-shared'
import { isNavigationFailure, Router } from 'vue-router'
import { createPageState } from '../../../framework/setup/page'
//#if _X_
import { hideActionSheet } from '../ui/popup/showActionSheet'
import { hideModal } from '../ui/popup/showModal'
//#endif
export type NavigateType =
| 'navigateTo'
......@@ -23,12 +19,6 @@ export function navigate(
{ type, url, tabBarText, events, isAutomatedTesting }: NavigateOptions,
__id__?: number
): Promise<void | { eventChannel?: EventChannel; __id__?: number }> {
//#if _X_
hideActionSheet()
hideModal()
uni.hideToast()
uni.hideLoading()
//#endif
const router = getApp().$router as Router
const { path, query } = parseUrl(url)
return new Promise((resolve, reject) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册