麻豆做爰免费观看-日本熟妇一区二区三区-欧美午夜精品一区二区-xxxxx国产-精品欧美日韩-五月天黄色小说-亚洲熟妇一区-jizz国产视频-国产91九色-www好男人-国产精品久久久免费-九九热精彩视频-www..com国产-午夜簧片-欧美一区中文字幕-在线观看亚洲一区二区-一级少妇精品久久久久久久-www.欧美国产-日韩欧美综合视频-成人性视频免费网站

027-81331413

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

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

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

  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;` })}}})