提交 56769ee9 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(my-alipay): uni.onKeyboardHeightChange 支持支付宝小程序

上级 c6cfc7c6
......@@ -4,6 +4,10 @@ import {
hasOwn
} from 'uni-shared'
import { $on, $off } from 'uni-core/runtime/event-bus'
let onKeyboardHeightChangeCallback
export {
setStorageSync,
getStorageSync,
......@@ -104,6 +108,21 @@ export function createIntersectionObserver (component, options) {
return my.createIntersectionObserver(options)
}
export function onKeyboardHeightChange (callback) {
// 与微信小程序一致仅保留最后一次监听
if (onKeyboardHeightChangeCallback) {
$off('uni:keyboardHeightChange', onKeyboardHeightChangeCallback)
}
onKeyboardHeightChangeCallback = callback
$on('uni:keyboardHeightChange', onKeyboardHeightChangeCallback)
}
export function offKeyboardHeightChange () {
// 与微信小程序一致移除最后一次监听
$off('uni:keyboardHeightChange', onKeyboardHeightChangeCallback)
onKeyboardHeightChangeCallback = null
}
export {
createMediaQueryObserver
}
......@@ -24,6 +24,8 @@ import {
initSpecialMethods
} from './util'
import { $emit } from 'uni-core/runtime/event-bus'
const hooks = [
'onShow',
'onHide',
......@@ -84,6 +86,9 @@ export default function parsePage (vuePageOptions) {
// 支付宝小程序有些页面事件只能放在events下
onBack () {
this.$vm.__call_hook('onBackPress')
},
onKeyboardHeight (res) {
$emit('uni:keyboardHeightChange', res)
}
},
__r: handleRef,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册