Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
e30ae5e9
U
uni-app
项目概览
DCloud
/
uni-app
15 天 前同步成功
通知
702
Star
38704
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e30ae5e9
编写于
1月 12, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 支持 offKeyboardHeightChange 方法
上级
9d217c26
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
29 addition
and
8 deletion
+29
-8
lib/apis.js
lib/apis.js
+1
-0
lib/modules.json
lib/modules.json
+2
-1
src/core/helpers/api.js
src/core/helpers/api.js
+4
-0
src/core/service/api/keyboard/keyboard.js
src/core/service/api/keyboard/keyboard.js
+9
-1
src/core/service/bridge.js
src/core/service/bridge.js
+6
-2
src/core/service/bridge/index.js
src/core/service/bridge/index.js
+3
-2
src/platforms/app-plus/service/index.js
src/platforms/app-plus/service/index.js
+4
-2
未找到文件。
lib/apis.js
浏览文件 @
e30ae5e9
...
@@ -131,6 +131,7 @@ const device = [
...
@@ -131,6 +131,7 @@ const device = [
const
keyboard
=
[
const
keyboard
=
[
'
hideKeyboard
'
,
'
hideKeyboard
'
,
'
onKeyboardHeightChange
'
,
'
onKeyboardHeightChange
'
,
'
offKeyboardHeightChange
'
,
'
getSelectedTextRange
'
'
getSelectedTextRange
'
]
]
...
...
lib/modules.json
浏览文件 @
e30ae5e9
...
@@ -162,7 +162,8 @@
...
@@ -162,7 +162,8 @@
"uni.createIntersectionObserver"
:
true
,
"uni.createIntersectionObserver"
:
true
,
"uni.createMediaQueryObserver"
:
true
,
"uni.createMediaQueryObserver"
:
true
,
"uni.hideKeyboard"
:
true
,
"uni.hideKeyboard"
:
true
,
"uni.onKeyboardHeightChange"
:
true
"uni.onKeyboardHeightChange"
:
true
,
"uni.offKeyboardHeightChange"
:
true
}
}
},
{
},
{
"name"
:
"event"
,
"name"
:
"event"
,
...
...
src/core/helpers/api.js
浏览文件 @
e30ae5e9
...
@@ -275,6 +275,10 @@ export function invokeCallbackHandler (invokeCallbackId, res, extras) {
...
@@ -275,6 +275,10 @@ export function invokeCallbackHandler (invokeCallbackId, res, extras) {
return
res
return
res
}
}
export
function
removeCallbackHandler
(
invokeCallbackId
)
{
delete
invokeCallbacks
[
invokeCallbackId
]
}
export
function
wrapperUnimplemented
(
name
)
{
export
function
wrapperUnimplemented
(
name
)
{
return
function
todo
(
args
)
{
return
function
todo
(
args
)
{
console
.
error
(
'
API `
'
+
name
+
'
` is not yet implemented
'
)
console
.
error
(
'
API `
'
+
name
+
'
` is not yet implemented
'
)
...
...
src/core/service/api/keyboard/keyboard.js
浏览文件 @
e30ae5e9
import
{
import
{
invoke
invoke
,
remove
}
from
'
uni-core/service/bridge
'
}
from
'
uni-core/service/bridge
'
import
{
import
{
...
@@ -15,5 +16,12 @@ onMethod('onKeyboardHeightChange', res => {
...
@@ -15,5 +16,12 @@ onMethod('onKeyboardHeightChange', res => {
})
})
export
function
onKeyboardHeightChange
(
callbackId
)
{
export
function
onKeyboardHeightChange
(
callbackId
)
{
// 与微信小程序一致仅保留最后一次监听
remove
(
callback
)
callback
=
callbackId
callback
=
callbackId
}
}
export
function
offKeyboardHeightChange
()
{
// 与微信小程序一致移除最后一次监听
callback
=
null
}
src/core/service/bridge.js
浏览文件 @
e30ae5e9
export
function
pack
(
args
)
{
export
function
pack
(
args
)
{
return
args
return
args
}
}
export
function
unpack
(
args
)
{
export
function
unpack
(
args
)
{
return
args
return
args
}
}
export
function
invoke
(...
args
)
{
export
function
invoke
(...
args
)
{
return
UniServiceJSBridge
.
invokeCallbackHandler
(...
args
)
return
UniServiceJSBridge
.
invokeCallbackHandler
(...
args
)
}
export
function
remove
(
args
)
{
return
UniServiceJSBridge
.
removeCallbackHandler
(
args
)
}
}
src/core/service/bridge/index.js
浏览文件 @
e30ae5e9
...
@@ -8,7 +8,8 @@ export const once = Emitter.$once.bind(Emitter)
...
@@ -8,7 +8,8 @@ export const once = Emitter.$once.bind(Emitter)
export
const
emit
=
Emitter
.
$emit
.
bind
(
Emitter
)
export
const
emit
=
Emitter
.
$emit
.
bind
(
Emitter
)
export
{
export
{
invokeCallbackHandler
invokeCallbackHandler
,
removeCallbackHandler
}
}
from
'
uni-helpers/api
'
from
'
uni-helpers/api
'
...
@@ -30,4 +31,4 @@ export function subscribeHandler (event, args, pageId) {
...
@@ -30,4 +31,4 @@ export function subscribeHandler (event, args, pageId) {
export
{
export
{
publishHandler
publishHandler
}
}
from
'
uni-platform/service/bridge
'
from
'
uni-platform/service/bridge
'
src/platforms/app-plus/service/index.js
浏览文件 @
e30ae5e9
...
@@ -3,7 +3,8 @@ import {
...
@@ -3,7 +3,8 @@ import {
}
from
'
uni-core/service/uni
'
}
from
'
uni-core/service/uni
'
import
{
import
{
invokeCallbackHandler
invokeCallbackHandler
,
removeCallbackHandler
}
from
'
uni-helpers/api
'
}
from
'
uni-helpers/api
'
import
{
import
{
...
@@ -35,6 +36,7 @@ uni.__$wx__ = wx
...
@@ -35,6 +36,7 @@ uni.__$wx__ = wx
UniServiceJSBridge
.
publishHandler
=
publishHandler
UniServiceJSBridge
.
publishHandler
=
publishHandler
UniServiceJSBridge
.
invokeCallbackHandler
=
invokeCallbackHandler
UniServiceJSBridge
.
invokeCallbackHandler
=
invokeCallbackHandler
UniServiceJSBridge
.
removeCallbackHandler
=
removeCallbackHandler
export
default
{
export
default
{
__vuePlugin
:
vuePlugin
,
__vuePlugin
:
vuePlugin
,
...
@@ -44,4 +46,4 @@ export default {
...
@@ -44,4 +46,4 @@ export default {
uni
,
uni
,
getApp
,
getApp
,
getCurrentPages
getCurrentPages
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录