提交 ce2e1171 编写于 作者: Q qiang

feat: app-plus add uni.onKeyboardHeightChange

上级 3142c341
...@@ -115,7 +115,8 @@ const device = [ ...@@ -115,7 +115,8 @@ const device = [
] ]
const keyboard = [ const keyboard = [
'hideKeyboard' 'hideKeyboard',
'onKeyboardHeightChange'
] ]
const ui = [ const ui = [
......
...@@ -152,7 +152,8 @@ ...@@ -152,7 +152,8 @@
"uni.stopPullDownRefresh": true, "uni.stopPullDownRefresh": true,
"uni.createSelectorQuery": true, "uni.createSelectorQuery": true,
"uni.createIntersectionObserver": true, "uni.createIntersectionObserver": true,
"uni.hideKeyboard": true "uni.hideKeyboard": true,
"uni.onKeyboardHeightChange": true
} }
}, { }, {
"name": "event", "name": "event",
......
import {
invoke
} from 'uni-core/service/bridge'
import {
onMethod
} from '../../platform'
const callbacks = []
onMethod('onKeyboardHeightChange', res => {
callbacks.forEach(callbackId => {
invoke(callbackId, res)
})
})
export function onKeyboardHeightChange (callbackId) {
callbacks.push(callbackId)
}
...@@ -63,6 +63,12 @@ function initGlobalListeners () { ...@@ -63,6 +63,12 @@ function initGlobalListeners () {
networkType networkType
}) })
}) })
plus.globalEvent.addEventListener('KeyboardHeightChange', function (event) {
publish('onKeyboardHeightChange', {
height: event.height
})
})
} }
function initAppLaunch (appVm) { function initAppLaunch (appVm) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册