Javascript SweetAlert(t4t5)无法解决如何显示ValidationError
我不断得到一个承诺错误: (索引):235未捕获(承诺中)类型错误:swal.showValidationError不是函数Javascript SweetAlert(t4t5)无法解决如何显示ValidationError,javascript,validation,sweetalert2,Javascript,Validation,Sweetalert2,我不断得到一个承诺错误: (索引):235未捕获(承诺中)类型错误:swal.showValidationError不是函数 在更改“预固定”和“然后”部分以尝试不同的sweetalert配置后,我一点也不知道。任何建议都将不胜感激因为SweetAlert2的行为与t4t5当代不同,我重写了部分功能: swal({ text: '@lang('global.message.not_visited')', content: { element: 'input',
在更改“预固定”和“然后”部分以尝试不同的sweetalert配置后,我一点也不知道。任何建议都将不胜感激因为SweetAlert2的行为与t4t5当代不同,我重写了部分功能:
swal({
text: '@lang('global.message.not_visited')',
content: {
element: 'input',
attributes: {
placeholder: '@lang('global.app.reason')',
type: 'text'
}
},
icon: 'info',
buttons: [ '@lang('global.app.cancel')', '@lang('global.app.ok')'],
closeModal: false,
})
.then(function(result) {
if(result === '' ) {
console.log('back');
$('button.notvisited').click();
return false;
}
else if (result) {
console.log($('button.notvisited'));
axios.post('{{ route('mobile.order.setstatus') }}',
{
order_id: $('button.notvisited').attr('data-id'),
user_id: $('button.notvisited').attr('data-usr'),
remark: result,
order_status: 'ORDER_STATUS_NOT_VISITED'
}).then((res) => {
if( res.data ) {
swal({
text: res.data.message,
icon: ( res.data.success ? 'info' : 'error' ),
}).then( function(result) {
if (result) {
document.location.href = '{{ route('mobile.order.overview') }}';
}
});
}
});
}
});
您的代码段正在使用not
swal({
text: '@lang('global.message.not_visited')',
content: {
element: 'input',
attributes: {
placeholder: '@lang('global.app.reason')',
type: 'text'
}
},
icon: 'info',
buttons: [ '@lang('global.app.cancel')', '@lang('global.app.ok')'],
closeModal: false,
})
.then(function(result) {
if(result === '' ) {
console.log('back');
$('button.notvisited').click();
return false;
}
else if (result) {
console.log($('button.notvisited'));
axios.post('{{ route('mobile.order.setstatus') }}',
{
order_id: $('button.notvisited').attr('data-id'),
user_id: $('button.notvisited').attr('data-usr'),
remark: result,
order_status: 'ORDER_STATUS_NOT_VISITED'
}).then((res) => {
if( res.data ) {
swal({
text: res.data.message,
icon: ( res.data.success ? 'info' : 'error' ),
}).then( function(result) {
if (result) {
document.location.href = '{{ route('mobile.order.overview') }}';
}
});
}
});
}
});