fix:修复wifi弹窗不同输入法导致的结构错层

This commit is contained in:
2026-06-03 13:42:48 +08:00
parent 048b0e9fa9
commit 350c6373ab

View File

@@ -312,6 +312,16 @@ const handleKeyboardHeightChange = (res) => {
keyboardHeight.value = res?.height || 0;
};
// 切换密码显示状态前先收起键盘,避免安全键盘和普通输入法切换时复用旧高度产生黑条。
const togglePasswordVisibility = () => {
uni.hideKeyboard({
complete() {
keyboardHeight.value = 0;
showPassword.value = !showPassword.value;
},
});
};
// 页面挂载后启动 WiFi 扫描流程。
onMounted(() => {
if (typeof uni.onKeyboardHeightChange === "function") {
@@ -498,6 +508,7 @@ onUnmounted(() => {
<input
class="input-field"
:password="!showPassword"
:adjust-position="false"
v-model="connectInput.password"
placeholder="输入网络密码"
placeholder-class="input-placeholder"
@@ -505,7 +516,7 @@ onUnmounted(() => {
@confirm="joinNetwork"
/>
<!-- 密码显示/隐藏切换按钮 -->
<view class="pwd-eye-btn" @click="showPassword = !showPassword">
<view class="pwd-eye-btn" @click="togglePasswordVisibility">
<image
:src="showPassword ? '../static/sicon/eye-on.png' : '../static/sicon/eye-off.png'"
mode="aspectFit"
@@ -560,6 +571,7 @@ onUnmounted(() => {
<input
class="input-field"
:password="!showPassword"
:adjust-position="false"
v-model="connectInput.password"
placeholder="输入网络密码"
placeholder-class="input-placeholder"
@@ -567,7 +579,7 @@ onUnmounted(() => {
@confirm="joinNetwork"
/>
<!-- 密码显示/隐藏切换按钮 -->
<view class="pwd-eye-btn" @click="showPassword = !showPassword">
<view class="pwd-eye-btn" @click="togglePasswordVisibility">
<image
:src="showPassword ? '../static/sicon/eye-on.png' : '../static/sicon/eye-off.png'"
mode="aspectFit"