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