提交 ce2e1171 编写于 作者: Q qiang

feat: app-plus add uni.onKeyboardHeightChange

上级 3142c341
......@@ -115,7 +115,8 @@ const device = [
]
const keyboard = [
'hideKeyboard'
'hideKeyboard',
'onKeyboardHeightChange'
]
const ui = [
......
......@@ -152,7 +152,8 @@
"uni.stopPullDownRefresh": true,
"uni.createSelectorQuery": true,
"uni.createIntersectionObserver": true,
"uni.hideKeyboard": true
"uni.hideKeyboard": true,
"uni.onKeyboardHeightChange": true
}
}, {
"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)
}
......@@ -62,6 +62,12 @@ function initGlobalListeners () {
isConnected: networkType !== 'none',
networkType
})
})
plus.globalEvent.addEventListener('KeyboardHeightChange', function (event) {
publish('onKeyboardHeightChange', {
height: event.height
})
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册