微信小程序 flex布局 如何使弹出的键盘不遮挡输入框
微信小程序的页面是flex布局,css如下:
page {
height: 100%;
display: flex !important;
flex-direction: column !important;
justify-content: space-between !important;
}
wxml如下:
<view class="weui-panel">
<view class="weui-panel__bd" wx:if="{{ticket.deleted != true}}">
<view class="weui-media-box weui-media-box_text">
<view class="weui-media-box__title weui-media-box__title_in-text">{{ticket.title}}</view>
<view class="weui-media-box__desc">
<text class="info" decode="{{true}}">
{{ticket.departureCity}} {{ticket.isSingleFlight == true ? ' ➝' : ' ⇄'}}{{ticket.isTurning == true ? ' '+ticket.turningCity : ''}} {{ticket.isTurning == true ? (ticket.isSingleFlight == true ? ' ➝' : ' ⇄') : ''}} {{ticket.arrivalCity}} {{ticket.departureDate}}
</text>
<text class="desc" decode="{{true}}">
{{ticket.comment == null ? '' : ticket.comment}}
</text>
</view>
<view class="weui-media-box__info">
<view class="weui-media-box__info__meta">发布时间:{{ticket.publishDate}}</view>
<view class="weui-media-box__info__meta weui-media-box__info__meta_extra" wx:if="{{role == 'admin'}}" bindtap="onEdit">编辑</view>
<view class="weui-media-box__info__meta weui-media-box__info__meta_extra" wx:if="{{role == 'admin'}}" bindtap="edit" bindtap="onDelete" data-id="{{ticket.id}}">删除</view>
</view>
</view>
</view>
</view>
<view id="comment" class="comment">
<view class="weui-cells__title">评论</view>
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell">
<view class="weui-cell__bd">
<input class="comment-input" bindfocus="inputComment" cursor-spacing='1000' maxlength="10" placeholder="最大输入长度10" />
</view>
</view>
</view>
</view>
这样评论输入框是在页面底部。但是每次键盘弹出的时候,会遮挡住输入框。请问应该怎么解决这个问题呢?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设置
cursor-spacing='20'
指定光标与键盘的距离为20px。20为例