提交 b8150070 编写于 作者: fxy060608's avatar fxy060608

feat(sdk): reLaunch

上级 c91d676a
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -36,7 +36,11 @@ export const navigateBack = defineAsyncApi<API_TYPE_NAVIGATE_BACK>(
uni.hideLoading()
if (page.$page.meta.isQuit) {
quit()
} else if (page.$page.id === 1 && __uniConfig.realEntryPagePath) {
} else if (
// 处于直达页面
page.$page.route === __uniConfig.entryPagePath &&
__uniConfig.realEntryPagePath
) {
// condition
__uniConfig.entryPagePath = __uniConfig.realEntryPagePath
delete __uniConfig.realEntryPagePath
......
......@@ -4,15 +4,14 @@ import {
ON_APP_ENTER_FOREGROUND,
ON_THEME_CHANGE,
ON_KEYBOARD_HEIGHT_CHANGE,
addLeadingSlash,
} from '@dcloudio/uni-shared'
import { $reLaunch } from '../../api/route/reLaunch'
import {
EVENT_BACKBUTTON,
backbuttonListener,
parseRedirectInfo,
initEnterOptions,
getEnterOptions,
initEnterReLaunch,
} from './utils'
export function initGlobalEvent() {
......@@ -36,10 +35,7 @@ export function initGlobalEvent() {
const info = parseRedirectInfo()
if (info && info.userAction) {
initEnterOptions(info)
$reLaunch(
{ url: addLeadingSlash(info.path) + info.query },
{ resolve() {}, reject() {} }
)
initEnterReLaunch(info)
}
emit(ON_APP_ENTER_FOREGROUND, getEnterOptions())
})
......
import { extend } from '@vue/shared'
import { parseQuery } from '@dcloudio/uni-shared'
import { addLeadingSlash, parseQuery } from '@dcloudio/uni-shared'
import { createLaunchOptions, LaunchOptions } from '@dcloudio/uni-core'
import { $reLaunch } from '../../api/route/reLaunch'
export const EVENT_BACKBUTTON = 'backbutton'
......@@ -34,6 +35,17 @@ export function initEnterOptions({
})
}
export function initEnterReLaunch(info: RedirectInfo) {
__uniConfig.realEntryPagePath =
__uniConfig.realEntryPagePath || __uniConfig.entryPagePath
__uniConfig.entryPagePath = info.path
__uniConfig.entryPageQuery = info.query
$reLaunch(
{ url: addLeadingSlash(info.path) + info.query },
{ resolve() {}, reject() {} }
)
}
export function initLaunchOptions({
path,
query,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册