[bugfix] ContactList: not trigger select event when click radio icon (#3218)

This commit is contained in:
neverland
2019-04-26 11:15:33 +08:00
committed by GitHub
parent 6fbdc4ffc3
commit 5ae6d3aabc
4 changed files with 69 additions and 36 deletions
+33 -29
View File
@@ -30,35 +30,39 @@ function ContactList(
slots: DefaultSlots,
ctx: RenderContext<ContactListProps>
) {
const List = props.list.map((item, index) => (
<Cell
key={item.id}
isLink
class={bem('item')}
valueClass={bem('item-value')}
scopedSlots={{
default: () => (
<Radio name={item.id}>
<div class={bem('name')}>{`${item.name}${item.tel}`}</div>
</Radio>
),
'right-icon': () => (
<Icon
name="edit"
class={bem('edit')}
onClick={event => {
event.stopPropagation();
emit(ctx, 'edit', item, index);
}}
/>
)
}}
onClick={() => {
emit(ctx, 'input', item.id);
emit(ctx, 'select', item, index);
}}
/>
));
const List = props.list.map((item, index) => {
const onClick = () => {
emit(ctx, 'input', item.id);
emit(ctx, 'select', item, index);
};
return (
<Cell
key={item.id}
isLink
class={bem('item')}
valueClass={bem('item-value')}
scopedSlots={{
default: () => (
<Radio name={item.id} onClick={onClick}>
<div class={bem('name')}>{`${item.name}${item.tel}`}</div>
</Radio>
),
'right-icon': () => (
<Icon
name="edit"
class={bem('edit')}
onClick={event => {
event.stopPropagation();
emit(ctx, 'edit', item, index);
}}
/>
)
}}
onClick={onClick}
/>
);
});
return (
<div class={bem()} {...inherit(ctx)}>