微信小程序輸入框上移問題解決
微信小程序的輸入框在上面還好,如果不是,在聚焦的時(shí)候頁(yè)面就會(huì)上移,上方的頁(yè)面信息會(huì)看不到,影響用戶操作
在這里可以手動(dòng)設(shè)置并獲取輸入框的高度來解決
這種方式雖然有的機(jī)子有點(diǎn)卡,但是已經(jīng)算是比較完美的解決方案了
頁(yè)面部分
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
< view class="page-bottom" style="bottom:{{bottom}}px"> < view class="block input-box"> < view class="block-left"> < input bindconfirm="toSubmit" value="{{code}}" bindfocus="inputFocus" bindblur="inputBlur" focus adjust-position="{{false}}" class="block-main" type="text" placeholder="手動(dòng)輸入" confirm-type="go" cursor-spacing="100"></ input > </ view > </ view > </ view > |
js部分
1 2 3 4 5 6 |
inputFocus (e) { this .setData({bottom: e.detail.height}) }, inputBlur () { this .setData({bottom: 0}) } |
如果您的問題還未解決可以聯(lián)系站長(zhǎng)付費(fèi)協(xié)助。

有問題可以加入技術(shù)QQ群一起交流學(xué)習(xí)
本站vip會(huì)員 請(qǐng)加入無憂模板網(wǎng) VIP群(50604020) PS:加入時(shí)備注用戶名或昵稱
普通注冊(cè)會(huì)員或訪客 請(qǐng)加入無憂模板網(wǎng) 技術(shù)交流群(50604130)
客服微信號(hào):15898888535
聲明:本站所有文章資源內(nèi)容,如無特殊說明或標(biāo)注,均為采集網(wǎng)絡(luò)資源。如若內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系站長(zhǎng)刪除。