input聚焦时改变位置光标和占位文字残留在原位
wxml
< view class = "test" > < view class = "header {{focused ? 'focused' : ''}}" > < input placeholder = "输入框" bindfocus = "focusHandler" bindblur = "blurHandler" /> </ view > </ view > |
wxss
page { height : 100% ; } .test { height : 100% ; } .header { padding : 50 rpx; background-color : #ccc ; transition: padding 0.3 s ease; } .header.focused { padding : 0 50 rpx; } |
js
Page({ data: { focused: false }, focusHandler() { this .setData({ focused: true }); }, blurHandler() { this .setData({ focused: false }); } }); |
必须使用 transition 才能重现这个 bug。
iOS 和 Android 真机均可重现,模拟器中无法重现。