错误
要接收支付过程中出现的错误信息:
- 添加
show_errors
事件处理,用于显示错误。
示例:
Copy
- typescript
headlessCheckout.form.onNextAction((nextAction) => {
switch (nextAction.type) {
case 'show_errors': {
this.errors = nextAction.data.errors;
}
}
});
- 在支付UI的HTML标记中添加错误显示。
示例:
Copy
- html
@if (errors.length) {
Errors:
@for (error of errors) {
<div>{{error.message}}</div>
}
}
本文对您的有帮助吗?
感谢您的反馈!
我们会查看您的留言并运用它改进用户体验。发现了错别字或其他内容错误? 请选择文本,然后按Ctrl+Enter。