[new feature] AddressList: add click-item event (#3942)

This commit is contained in:
neverland
2019-07-23 20:50:31 +08:00
committed by GitHub
parent 4d0d54dbf4
commit 42afafac2b
5 changed files with 29 additions and 2 deletions
+6 -2
View File
@@ -24,6 +24,7 @@ export type AddressItemProps = {
export type AddressItemEvents = {
onEdit(): void;
onClick(): void;
onSelect(): void;
};
@@ -37,10 +38,12 @@ function AddressItem(
) {
const { disabled, switchable } = props;
function onSelect() {
function onClick() {
if (switchable) {
emit(ctx, 'select');
}
emit(ctx, 'click');
}
const renderRightIcon = () => (
@@ -50,6 +53,7 @@ function AddressItem(
onClick={(event: Event) => {
event.stopPropagation();
emit(ctx, 'edit');
emit(ctx, 'click');
}}
/>
);
@@ -79,7 +83,7 @@ function AddressItem(
default: renderContent,
'right-icon': renderRightIcon
}}
onClick={onSelect}
onClick={onClick}
{...inherit(ctx)}
/>
);