From 9ed86c8985df5f168b289b65a80b9a6d788e4590 Mon Sep 17 00:00:00 2001 From: qiang Date: Mon, 19 Aug 2019 15:49:53 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BF=AE=E6=94=B9=20softinputMode=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=AF=B4=E6=98=8E=20fixed=20#686?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/component/input.md | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/docs/component/input.md b/docs/component/input.md index 4397cf464..b1f7dd61a 100644 --- a/docs/component/input.md +++ b/docs/component/input.md @@ -21,7 +21,7 @@ |cursor|Number||指定focus时的光标位置|| |selection-start|Number|-1|光标起始位置,自动聚集时有效,需与selection-end搭配使用|| |selection-end|Number|-1|光标结束位置,自动聚集时有效,需与selection-start搭配使用|| -|adjust-position|Boolean|true|键盘弹起时,是否自动上推页面|5+App、微信小程序、百度小程序、QQ小程序| +|adjust-position|Boolean|true|键盘弹起时,是否自动上推页面|5+App(softinputMode 为 adjustResize 时无效)、微信小程序、百度小程序、QQ小程序| |@input|EventHandle||当键盘输入时,触发input事件,event.detail = {value}|差异见下方 Tips| |@focus|EventHandle||输入框聚焦时触发,event.detail = { value, height },height 为键盘高度|仅微信小程序、5+App(HBuilderX 2.0+ [nvue uni-app模式](http://ask.dcloud.net.cn/article/36074)) 、QQ小程序支持 height| |@blur|EventHandle||输入框失去焦点时触发,event.detail = {value: value}|| @@ -99,34 +99,16 @@ this.$mp.page.$getAppWebview().setStyle({ #### 关于软键盘弹出的逻辑说明 -App平台,软键盘弹出有adjustResize|adjustPan 两种模式 +App平台软键盘弹出有 adjustResize|adjustPan 两种模式,默认为 adjustPan 模式,小程序平台只支持 adjustPan 模式,H5平台因不同浏览器而异 - adjustResize:软键盘弹出时,webview窗体高度挤压。屏幕高度=webview窗体高度+软键盘高度 - adjustPan:软键盘弹出时,webview窗体高度不变,但窗体上推,以保证输入框不被软键盘盖住 -除了App平台,其他平台只支持adjustPan模式。App平台两种模式都支持,具体如下: -- Android:默认为adjustResize。配置修改只能在manifest中修改,全局生效。如果改为adjustPan,无法顺利上推窗体,底部的input会被软键盘盖住 -- iOS平台:默认为adjustPan。配置可以在manifest中全局修改,也可以单独页面设置style。没有类似Android的局限。 +配置方式,在 pages.json 中配置 style -如下为全局或页面的配置方式: -- 在manifest中配置 ```json - "app-plus": { - "softinput": { - "mode": "adjustResize|adjustPan" // 软键盘弹出模式 - } - } -``` - -- 如需要单个页面配置,则在pages.json中配置 -```json - { - "path": "pages/component/input/input", - "style": { - "app-plus":{ - "softinputMode": "adjustResize" //仅iOS支持单个页面配置 - } - } - } +"app-plus": { + "softinputMode": "adjustResize" +} ``` App端开发聊天类应用时,目前推荐改为adjustResize模式。在hello uni-app的模板-聊天中有详细示例。 -- GitLab