提交 34c5d6e3 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix(navigateBack): 修复 navigateBack options ts 类型可选引起 ts 错误

上级 e6965d9a
......@@ -40,11 +40,9 @@ export const navigateBack = defineAsyncApi<API_TYPE_NAVIGATE_BACK>(
quit()
} else if (isDirectPage(page)) {
reLaunchEntryPage()
} else if (args) {
const { delta, animationType, animationDuration } = args
back(delta!, animationType, animationDuration)
} else {
back()
const { delta, animationType, animationDuration } = args!
back(delta!, animationType, animationDuration)
}
return resolve()
},
......@@ -67,7 +65,7 @@ function quit() {
}
function back(
delta: number = 1,
delta: number,
animationType?: string,
animationDuration?: number
) {
......
......@@ -33,18 +33,9 @@ const ANIMATION_OUT = [
]
type AnimationToType = Parameters<typeof uni.navigateTo>[0]['animationType']
type AnimationBackType =
| 'auto'
| 'none'
| 'slide-out-right'
| 'slide-out-left'
| 'slide-out-top'
| 'slide-out-bottom'
| 'fade-out'
| 'zoom-in'
| 'zoom-fade-in'
| 'pop-out'
type AnimationBackType = Required<
Parameters<typeof uni.navigateBack>
>[0]['animationType']
export const navigatorProps = {
hoverClass: {
type: String,
......
......@@ -23,7 +23,7 @@ export const navigateBack = defineAsyncApi<API_TYPE_NAVIGATE_BACK>(
return reject(ON_BACK_PRESS)
}
getApp().$router.go(args && args.delta ? -args.delta : -1)
getApp().$router.go(-args!.delta!)
return resolve()
},
NavigateBackProtocol,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册