小程序----textarea层叠问题
textarea 层级最高,解决问题,通过textarea 和 text 互换
显示的时候用text, 输入的时候用textarea
<view class="sms-ts-input" style="padding:16rpx 0"> <text wx:if="{{!ocr.placeAreaShow}}" bindtap="textToArea">{{ocr.idaddress}}</text> <textarea wx:if="{{ocr.placeAreaShow}}" type="text" bindinput="idaddressInputChanged" bindblur="areaToText" placeholder="请输入地址" value="{{ocr.idaddress}}" disabled="{{!page.ocr.isIdaddressAllowEdit}}" auto-height="true" auto-focus="true" style="line-height:1.5em;width:100%;" class="self-place-textarea"> </textarea> </view>
idaddressInputChanged(i) { this.data.ocr.idaddress = i.detail.value, this.ocrCommonInputCheck() }, // text -> textarea textToArea() { this.setData({ "ocr.placeAreaShow": true }) }, // textarea -> text areaToText() { const address = this.data.ocr.idaddress this.setData({ "ocr.placeAreaShow": false, "ocr.idaddress": address, }) },
你对生活笑,生活不会对你哭。