提交 af4c88e3 编写于 作者: Q qiang

fix(uvue): 应用页面动画配置

上级 e46291e3
......@@ -72,21 +72,24 @@ function back(
const backPage = function (webview: IPage) {
if (animationType) {
closeWebview(webview, animationType, animationDuration || ANI_DURATION)
animationDuration = animationDuration || ANI_DURATION
} else {
if (currentPage.$page.openType === 'redirectTo') {
// 如果是 redirectTo 跳转的,需要指定 back 动画
closeWebview(webview, ANI_CLOSE, ANI_DURATION)
animationType = ANI_CLOSE
animationDuration = ANI_DURATION
} else {
closeWebview(webview, 'auto')
animationType = 'auto'
}
}
pages
.slice(len - delta, len)
.forEach((page) => removePage(page as ComponentPublicInstance))
closeWebview(webview, animationType, animationDuration, () => {
pages
.slice(len - delta, len)
.forEach((page) => removePage(page as ComponentPublicInstance))
// 前一个页面触发 onShow
invokeHook(ON_SHOW)
})
// TODO setStatusBarStyle()
// 前一个页面触发 onShow
invokeHook(ON_SHOW)
}
const webview = __pageManager.findPageById(currentPage.$page.id + '')!
......
import { EventChannel, ON_HIDE, parseUrl } from '@dcloudio/uni-shared'
import { getRouteMeta, invokeHook } from '@dcloudio/uni-core'
import { getCurrentPage, getRouteMeta, invokeHook } from '@dcloudio/uni-core'
import {
API_NAVIGATE_TO,
API_TYPE_NAVIGATE_TO,
......@@ -85,6 +85,10 @@ function initAnimation(
animationType?: string,
animationDuration?: number
) {
// 首页去除动画
if (!getCurrentPage()) {
return ['none', 0] as const
}
const { globalStyle } = __uniConfig
const meta = getRouteMeta(path)!
return [
......
......@@ -4,19 +4,28 @@ export function showWebview(
nPage: IPage,
animationType: string,
animationDuration: number,
showCallback: Function,
showCallback: () => void,
delay?: number
) {
// TODO options
nPage.startRender()
nPage.show()
nPage.show(
new Map<string, any>([
['animationType', animationType],
['animationDuration', animationDuration],
]),
showCallback
)
}
export function closeWebview(
nPage: IPage,
animationType: string,
animationDuration?: number
animationDuration?: number,
callback?: () => void
) {
// options
nPage.close()
const options = new Map<string, any>([['animationType', animationType]])
if (typeof animationDuration === 'number') {
options.set('animationDuration', animationDuration)
}
nPage.close(options, callback)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册