微信小程序鍵盤彈出擋住輸入框問題解決方案
問題:微信小程序聊天輸入框點擊后,鍵盤彈出擋住輸入框
解決辦法:
- 1、給輸入框添加一個
bindkeyboardheightchange
事件,獲取鍵盤的高度
getKeyBoardHeight(event:any){
let height = event?.detail?.height || 0
this.setData({
KeyBoardHeight:height
})
},
-
2、給發(fā)送消息的盒子一個bottom
bottom
為監(jiān)聽到的鍵盤的高度.send-msg { display: flex; align-items: flex-end; padding: 16rpx 30rpx; width: 100%; min-height: 177rpx; position: fixed; bottom: 0; background: #f7f8f7; }
<view class="send-msg" style="bottom: {{KeyBoardHeight}}px;"> <view class="chat-textarea"> <textarea wx:if="{{isTypeText}}" model:value="{{chatMsg}}" maxlength="300" :show-confirm-bar="false" auto-height bind:input="inputValue" bindkeyboardheightchange="getKeyBoardHeight" ></textarea> </view> </view>
效果圖:文章來源:http://www.zghlxwxcb.cn/news/detail-843796.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-843796.html
到了這里,關于微信小程序----鍵盤彈出擋住輸入框問題解決方案的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!