HZH8997
HZH8997
  • 发布:2022-01-12 14:21
  • 更新:2023-03-13 04:21
  • 阅读:3666

uni.showModal 如何 给输入框设置默认内容

分类:uni-app

uni.showModal 设置默认输入内容的时候 h5可以, app 变成了提示,详见附件图片

能不能 加个默认内容参数啊

//重命名、创建文件夹  
            tipInputBox(type,name){ ///type 0,重命名; 1,创建文件夹  
                uni.showModal({  
                    title: type ? '新建文件夹' : '重命名',  
                    editable:true,  
                    placeholderText:type ? '' : (name ? name : ''),  
                    content:type ? '' : (name ? name : ''),  
                    confirmColor:publicStyleObj.uniThemeColor,  
                    success: function(res) {  
                        if (res.confirm) {  
                            if(!res.content){  
                                type ? _this.$showToast('文件夹名称不能为空') : _this.$showToast('文件名不能为空')  
                                return  
                            }else{  
                                if(type){//创建文件夹  
                                    _this.config.c_dir_par.name = res.content  
                                    _this.createDir()  
                                }else{//重命名  
                                    _this.config.r_dir_par.name = res.content  
                                    _this.fileRename()  
                                }  
                            }  
                            console.log('用户点击确定',res);  
                        } else if (res.cancel) {  
                            console.log('用户点击取消');  
                        }  
                    }  
                });  
            },
2022-01-12 14:21 负责人:DCloud_UNI_LXH 分享
已邀请:
周国波

周国波

您好,我近期也在研究这个功能,今晚刚好实现了
以下是我写的(使用的 content 参数)

uni.showModal({
title: '验证密码',
cancelColor: "#FF0606",
placeholderText: '请输入管理密码',
content: '默认输入内容',
editable: 'true',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});

  • Junan_

    谢谢

    2024-08-08 14:21

  • 9***@qq.com

    输入框也是没有默认内容,content在app端也是空

    2025-02-13 16:50

该问题目前已经被锁定, 无法添加新回复