mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
fix: select 接口报错时 url 应该显示为实际请求地址 (#5033)
This commit is contained in:
parent
8e5ffe7d23
commit
27891108fe
@ -152,6 +152,18 @@ export function wrapControl<
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
|
||||
if (!name) {
|
||||
// 一般情况下这些表单项都是需要 name 的,提示一下
|
||||
if (
|
||||
typeof type === 'string' &&
|
||||
(type.startsWith('input-') ||
|
||||
type.endsWith('select') ||
|
||||
type === 'switch' ||
|
||||
type === 'textarea' ||
|
||||
type === 'radios')
|
||||
) {
|
||||
console.warn('name is required', this.props.$schema);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import {str2rules, validate as doValidate} from '../utils/validations';
|
||||
import {Api, Payload, fetchOptions} from '../types';
|
||||
import {ComboStore, IComboStore, IUniqueGroup} from './combo';
|
||||
import {evalExpression} from '../utils/tpl';
|
||||
import {isEffectiveApi} from '../utils/api';
|
||||
import {buildApi, isEffectiveApi} from '../utils/api';
|
||||
import findIndex from 'lodash/findIndex';
|
||||
import {
|
||||
isArrayChildrenModified,
|
||||
@ -535,6 +535,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
|
||||
let result: any = null;
|
||||
|
||||
if (!json.ok) {
|
||||
const apiObject = buildApi(api, data);
|
||||
setErrorFlag !== false &&
|
||||
setError(
|
||||
self.__('Form.loadOptionsFailed', {
|
||||
@ -543,7 +544,7 @@ export const FormItemStore = StoreNode.named('FormItemStore')
|
||||
);
|
||||
getEnv(self).notify(
|
||||
'error',
|
||||
self.errors.join('') || `${api}:${json.msg}`,
|
||||
self.errors.join('') || `${apiObject.url}:${json.msg}`,
|
||||
json.msgTimeout !== undefined
|
||||
? {
|
||||
closeButton: true,
|
||||
|
Loading…
Reference in New Issue
Block a user