mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 04:48:32 +08:00
mapping 对于 boolean 的处理不太合理 (#1690)
This commit is contained in:
parent
b7c5da3da5
commit
45343a7ffd
@ -54,17 +54,19 @@ export class MappingField extends React.Component<MappingProps, object> {
|
||||
<span className="text-muted">{placeholder}</span>
|
||||
);
|
||||
|
||||
key = typeof key === 'string' ? key.trim() : key; // trim 一下,干掉一些空白字符。
|
||||
key =
|
||||
typeof key === 'string'
|
||||
? key.trim()
|
||||
: key === true
|
||||
? '1'
|
||||
: key === false
|
||||
? '0'
|
||||
: key; // trim 一下,干掉一些空白字符。
|
||||
|
||||
if (typeof key !== 'undefined' && map && (map[key] ?? map['*'])) {
|
||||
viewValue = render(
|
||||
'tpl',
|
||||
map[key] ??
|
||||
(key === true && map['1']
|
||||
? map['1']
|
||||
: key === false && map['0']
|
||||
? map['0']
|
||||
: map['*']) // 兼容平台旧用法:即 value 为 true 时映射 1 ,为 false 时映射 0
|
||||
map[key] ?? map['*'] // 兼容平台旧用法:即 value 为 true 时映射 1 ,为 false 时映射 0
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user