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