uni-app uni.showmodel editable 鸿蒙端没有输入的输入框

uni-app uni.showmodel editable 鸿蒙端没有输入的输入框

开发环境 版本号 项目创建方式
Windows 11 24H2 HBuilderX

示例代码:

uni.showModal({  
    title: '邮件推送PDF订单\n请输入客户邮件地址',  
    content: '',  
    editable: true,  
    confirmText: '确定',  
    cancelText: '取消',  
    success: (res) => {  
        if (res.confirm) {  
            const mail = res.content;  
            // 邮箱正则表达式  
            const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;  
            if (!mail || !emailRegex.test(mail)) {  
                uni.showToast({  
                    title: '请输入有效的邮箱地址',  
                    icon: 'none',  
                    duration: 2000  
                });  
                return;  
            }  
            this.sendEmailToCustomers(mail);  
        } else if (res.cancel) {  
        }  
    }  
});

操作步骤:

  • uni.showmodel中启用
editable: true,

预期结果:

  • 正常显示输入框等待用户数据

实际结果:

  • 没有任何输入框

bug描述:

  • 在鸿蒙端没有输入的输入框 iOS和安卓正常有输入的输入框


更多关于uni-app uni.showmodel editable 鸿蒙端没有输入的输入框的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

这个是鸿蒙的原生弹窗,还没有提供输入的功能

更多关于uni-app uni.showmodel editable 鸿蒙端没有输入的输入框的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


之后会进行适配吗

回复 3***@qq.com: 鸿蒙原生弹窗有了类似功能就会进行适配了

这是一个已知的鸿蒙系统兼容性问题。在HarmonyOS上,uni.showModal的editable属性确实存在无法显示输入框的情况。

解决方案:

  1. 使用条件编译针对鸿蒙系统改用其他输入方式:
// #ifdef HARMONY
uni.showActionSheet({
    // 替代方案
})
// #endif
  1. 或者统一改用uni-popup组件中的input模式:
this.$refs.popup.open('input')
回到顶部