fix:wifi页面解决输入框遮住问题
This commit is contained in:
@@ -23,6 +23,7 @@ const connectingWifi = ref(null);
|
||||
const connectInput = ref({ ssid: "", password: "" });
|
||||
const connectMode = ref("secure"); // secure | open | manual
|
||||
const connectError = ref("");
|
||||
const keyboardHeight = ref(0);
|
||||
|
||||
const progress = ref(0);
|
||||
let progressTimer = null;
|
||||
@@ -289,8 +290,16 @@ const handleRetry = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 监听系统输入法高度,用于让底部弹窗避开键盘遮挡。
|
||||
const handleKeyboardHeightChange = (res) => {
|
||||
keyboardHeight.value = res?.height || 0;
|
||||
};
|
||||
|
||||
// 页面挂载后启动 WiFi 扫描流程。
|
||||
onMounted(() => {
|
||||
if (typeof uni.onKeyboardHeightChange === "function") {
|
||||
uni.onKeyboardHeightChange(handleKeyboardHeightChange);
|
||||
}
|
||||
startScanning();
|
||||
});
|
||||
|
||||
@@ -302,6 +311,9 @@ onShow(() => {
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (typeof uni.offKeyboardHeightChange === "function") {
|
||||
uni.offKeyboardHeightChange(handleKeyboardHeightChange);
|
||||
}
|
||||
clearInterval(progressTimer);
|
||||
clearTimeout(timeoutTimer);
|
||||
wx.offGetWifiList && wx.offGetWifiList();
|
||||
@@ -446,7 +458,7 @@ onUnmounted(() => {
|
||||
|
||||
<!-- CONNECTING 底部弹窗 -->
|
||||
<view v-if="currentState === 'CONNECTING'" class="sheet-mask" @click="closeConnectSheet">
|
||||
<view class="sheet" @click.stop="">
|
||||
<view class="sheet" :style="{ marginBottom: keyboardHeight + 'px' }" @click.stop="">
|
||||
<image src="../static/ota/ota-bg.png" mode="aspectFill" class="sheet-bg" />
|
||||
<view class="sheet-inner">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user