fix(AddressList): incorrect tel when isDefault is 0 (#5232)

This commit is contained in:
neverland 2019-12-09 19:43:46 +08:00 committed by GitHub
parent a047717016
commit 2fd4f393b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,28 +60,36 @@ function AddressItem(
/> />
); );
const genContent = () => { function genTag() {
if (props.data.isDefault && props.defaultTagText) {
return (
<Tag type="danger" round class={bem('tag')}>
{props.defaultTagText}
</Tag>
);
}
}
function genContent() {
const { data } = props; const { data } = props;
const Info = [ const Info = [
<div class={bem('name')}> <div class={bem('name')}>
{`${data.name} ${data.tel}`} {`${data.name} ${data.tel}`}
{data.isDefault && props.defaultTagText && ( {genTag()}
<Tag type="danger" round class={bem('tag')}>
{props.defaultTagText}
</Tag>
)}
</div>, </div>,
<div class={bem('address')}>{data.address}</div> <div class={bem('address')}>{data.address}</div>
]; ];
return switchable && !disabled ? ( if (switchable && !disabled) {
return (
<Radio name={data.id} iconSize={16}> <Radio name={data.id} iconSize={16}>
{Info} {Info}
</Radio> </Radio>
) : (
Info
); );
}; }
return Info;
}
return ( return (
<Cell <Cell
@ -106,4 +114,6 @@ AddressItem.props = {
defaultTagText: String defaultTagText: String
}; };
export default createComponent<AddressItemProps, AddressItemEvents>(AddressItem); export default createComponent<AddressItemProps, AddressItemEvents>(
AddressItem
);