我希望当用户尝试提交一个空表单时,警报不会消失,相反,它应该在相同的警报中显示一些错误。我尝试执行swal.showInputError(“某些错误”),但它给出一个错误,它是无效的功能。我尝试查看文档,但找不到任何...
这是我的代码-
swal({
title:"Enter a Username",
content: {
element: "input",
attributes: {
placeholder: "Type your username",
type: "text"
},
},
className: "mySwal"
}).then((username)=>{
//get the username
if(username){
}else{
}
});
发布于 2018-05-28 18:16:20
您可以使用此函数:
inputValidator: (value) => {
return !value && 'You need to write something!'
}
这将验证用户是否正在写入值。
https://stackoverflow.com/questions/48155452
复制相似问题