onLoad() {
const platform = uni.getSystemInfoSync().platform
this.isIOS = platform === 'ios'
const that = this
this.updatePosition(0)
let keyboardHeight = 0
uni.onKeyboardHeightChange(res => {
if (res.height === keyboardHeight) return
const duration = res.height > 0 ? res.duration * 1000 : 0
keyboardHeight = res.height
setTimeout(() => {
uni.pageScrollTo({
scrollTop: 0,
success() {
that.updatePosition(keyboardHeight)
that.editorCtx.scrollIntoView()
}
})
}, duration)
})
},
updatePosition(keyboardHeight) {
const toolbarHeight = 50
const { windowHeight, platform } = uni.getSystemInfoSync()
let editorHeight = keyboardHeight > 0 ? (windowHeight - keyboardHeight - toolbarHeight) : windowHeight
this.editorHeight = editorHeight
this.keyboardHeight = keyboardHeight
},
onEditorReady() {
const that = this
uni.createSelectorQuery().select('#editor').context(function (res) {
that.editorCtx = res.context
}).exec()
},
3 个回复
张西西 - 123
解决了吗
jimu
2022都要完了。 这个问题多久可以解决一下呢。
IM柳暗花明
2024此问题,ios依然存在