diff --git a/pages/template/navbar-lite/navbar-lite.uvue b/pages/template/navbar-lite/navbar-lite.uvue index 03afcbdcba6f9260087b381a32bff9ff9700d63d..1b06e34aa8b04f88e70905ca5de773b4af281869 100644 --- a/pages/template/navbar-lite/navbar-lite.uvue +++ b/pages/template/navbar-lite/navbar-lite.uvue @@ -37,7 +37,7 @@ - + @@ -52,6 +52,7 @@ isLeft: false, navigationBarTextColor: '#000', indexView: 0, + windowHeight: 0, inputBottom: '0px' } }, @@ -100,11 +101,14 @@ ChangeView(e:UniRadioGroupChangeEvent){ this.indexView = parseInt(e.detail.value) }, - onInputFocus(e:UniInputFocusEvent ) { - this.inputBottom = `${e.detail.height}px`; - }, - onInputBlur(e:UniInputBlurEvent) { + onInputBlur(_:UniInputBlurEvent) { this.inputBottom = '0px'; + }, + onInputKeyboardChange(e:UniInputKeyboardHeightChangeEvent) { + let inputBottom = e.target?.getBoundingClientRect()?.bottom??this.windowHeight; + let remainHeight = this.windowHeight - inputBottom; + let bottom = (remainHeight > e.detail.height)?0:(e.detail.height-remainHeight); + this.inputBottom = `${bottom}px`; }, // 自动化测试 getLifeCycleNum() : number { @@ -114,6 +118,12 @@ setLifeCycleNum(num : number) { setLifeCycleNum(num) }, + }, + onReady() { + this.windowHeight = uni.getWindowInfo().windowHeight; + }, + onResize() { + this.windowHeight = uni.getWindowInfo().windowHeight; } }