hookehuyr

fix 错误提示优化,显示具体错误信息

<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-02-13 16:28:32
* @LastEditTime: 2025-02-17 15:02:03
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
......@@ -1160,7 +1160,15 @@ const onSubmit = async (values) => { // 表单提交回调
};
const onFailed = (errorInfo) => { // 提交表单且验证不通过后触发
showToast('有填写错误,请检查')
const error_item = errorInfo.errors[0];
// 通过name找到对应的label
let error_name = '';
formData.value.forEach(item => {
if (item.key === error_item.name) {
error_name = item.component_props.label
}
});
showToast(error_name + ': ' + error_item.message);
}
</script>
......