You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
971 B
30 lines
971 B
import {
|
|
lastStatusBarStyle,
|
|
setStatusBarStyle
|
|
} from '../../bridge'
|
|
export function onWebviewPopGesture (webview) {
|
|
let popStartStatusBarStyle
|
|
webview.addEventListener('popGesture', e => {
|
|
if (e.type === 'start') {
|
|
// 设置下一个页面的 statusBarStyle
|
|
const pages = getCurrentPages()
|
|
const page = pages[pages.length - 2]
|
|
popStartStatusBarStyle = lastStatusBarStyle
|
|
const statusBarStyle = page && page.$page.meta.statusBarStyle
|
|
statusBarStyle && setStatusBarStyle(statusBarStyle)
|
|
} else if (e.type === 'end' && !e.result) {
|
|
// 拖拽未完成,设置为当前状态栏前景色
|
|
setStatusBarStyle(popStartStatusBarStyle)
|
|
} else if (e.type === 'end' && e.result) {
|
|
const pages = getCurrentPages()
|
|
const page = pages[pages.length - 1]
|
|
page && page.$remove()
|
|
|
|
setStatusBarStyle()
|
|
|
|
UniServiceJSBridge.emit('onAppRoute', {
|
|
type: 'navigateBack'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|