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

fix(v3): backbutton with preload

上级 47e2cb45
...@@ -59,10 +59,17 @@ function initGlobalListeners () { ...@@ -59,10 +59,17 @@ function initGlobalListeners () {
const globalEvent = requireNativePlugin('globalEvent') const globalEvent = requireNativePlugin('globalEvent')
const emit = UniServiceJSBridge.emit const emit = UniServiceJSBridge.emit
// splashclosed 时开始监听 backbutton if (weex.config.preload) {
plus.globalEvent.addEventListener('splashclosed', () => { if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] preload.addEventListener.backbutton')
}
plus.key.addEventListener('backbutton', backbuttonListener) plus.key.addEventListener('backbutton', backbuttonListener)
}) } else {
// splashclosed 时开始监听 backbutton
plus.globalEvent.addEventListener('splashclosed', () => {
plus.key.addEventListener('backbutton', backbuttonListener)
})
}
plus.globalEvent.addEventListener('pause', () => { plus.globalEvent.addEventListener('pause', () => {
emit('onAppEnterBackground') emit('onAppEnterBackground')
...@@ -230,4 +237,4 @@ export function registerApp (appVm) { ...@@ -230,4 +237,4 @@ export function registerApp (appVm) {
__uniConfig.ready = true __uniConfig.ready = true
process.env.NODE_ENV !== 'production' && perf('registerApp') process.env.NODE_ENV !== 'production' && perf('registerApp')
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册