欧美日韩1234-岳两女共夫互换观看视频-日本不卡一区二区-gogogo高清国语完整-国产区在线-狠久久-男男互操视频-另类国产-欧美人与禽猛交乱配视频-欧美另类一区-久久成人在线视频-国产一级片av-青青草视频播放-欧美三级黄-日日射天天射-在线国产欧美-日韩永久-国产黄色成人-伊人三区-国产午夜精品理论片-999精彩视频-免费看av软件-欧美xxxx喷水-国产蜜臀-美女四肢被绑在床扒衣-日本公妇乱淫-99久久久国产精品无码性

027-81331413

微信小程序input怎么禁止輸入漢字

發布時間:2020-10-30 瀏覽:3565

最近在開發中遇到的一些坑點

  1. 表單組件(input)如何阻止冒泡

  2. 在容器(fixed)中的input如何彈出鍵盤

阻止input冒泡

  • <view bind:tap="onTap" class="container">

  • <input bindinput="onBindInput" type="text"/>

  • </view>


上例中input操作會冒泡到container,導致

  • onTap

響應執行

修正

  • <view bind:tap="onTap" class="container">

  • <input bindinput="onBindInput" type="text" catch:tap="empty"/>

  • </view>


冒泡的問題是由input的tap事件導致,因此定義一個empty的空方法,使它響應input的catch:tap,來達到阻止input的冒泡的作用

在容器(fixed)中的input如何彈出鍵盤

  • <view class="container" style="position: fixed; bottom: 0">

  • <input bindinput="onBindInput" type="text"/>

  • </view>


container組件在屏幕底部出現,點擊Input組件時,彈出的鍵盤會遮蓋input輸入框

修正

  • <view class="container" style="position: fixed; bottom: 0; {{mystyle}}">

  • <input bindinput="onBindInput" bindkeyboardheightchange="onkeybord" type="text"/>

  • </view>


Page({data: {mystyle: '',},onkeybord(e){let detail = e.detaillet kbHeight = detail.heightlet tool = Pager.getElementsById('reminder-tool')if (kbHeight === 0) {this.setData({mystyle: ' ' })}if (kbHeight && kbHeight > 0) {this.setData({mystyle: `bottom: ${kbHeight-40}px;` })}}})