提交 bcd3a6be 编写于 作者: DCloud-yyl's avatar DCloud-yyl

添加示例演示input框如何通过代码控制不被软键盘遮挡

(cherry picked from commit 8554e406)
上级 bb209b71
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
</list-item> </list-item>
</list-view> </list-view>
<web-view v-if="indexView==2" src="/hybrid/html/local.html" id="webv" style="height:380px"></web-view> <web-view v-if="indexView==2" src="/hybrid/html/local.html" id="webv" style="height:380px"></web-view>
<view style="position: relative;bottom: 0;"> <view style="position:relative;background-color:white;" :style="{bottom: inputBottom}">
<input placeholder="滚动视图外的居底输入框" adjust-position="true" /> <input placeholder="滚动视图外的居底输入框" adjust-position="false" @focus="onInputFocus" @blur="onInputBlur" />
</view> </view>
</view> </view>
...@@ -51,7 +51,8 @@ ...@@ -51,7 +51,8 @@
title: 'Hello uni-app', title: 'Hello uni-app',
isLeft: false, isLeft: false,
navigationBarTextColor: '#000', navigationBarTextColor: '#000',
indexView: 0 indexView: 0,
inputBottom: '0px'
} }
}, },
methods: { methods: {
...@@ -99,6 +100,12 @@ ...@@ -99,6 +100,12 @@
ChangeView(e:UniRadioGroupChangeEvent){ ChangeView(e:UniRadioGroupChangeEvent){
this.indexView = parseInt(e.detail.value) this.indexView = parseInt(e.detail.value)
}, },
onInputFocus(e:UniInputFocusEvent ) {
this.inputBottom = `${e.detail.height}px`;
},
onInputBlur(e:UniInputBlurEvent) {
this.inputBottom = '0px';
},
// 自动化测试 // 自动化测试
getLifeCycleNum() : number { getLifeCycleNum() : number {
return state.lifeCycleNum return state.lifeCycleNum
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册