Skip to content

Commit

Permalink
Merge a4e60de into 232fb94
Browse files Browse the repository at this point in the history
  • Loading branch information
z2014 committed Jul 22, 2020
2 parents 232fb94 + a4e60de commit 8576b23
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,25 @@ class Dialog extends Component {

renderButtons() {
return this.props.buttons.map((action, idx) => {
const {type, label, ...others} = action;
const {type, label, onClick, ...others} = action;
const className = classNames({
'weui-dialog__btn': true,
'weui-dialog__btn_default': type === 'default',
'weui-dialog__btn_primary': type === 'primary'
});

return (
<a key={idx} href="javascript:;" {...others} className={className}>{label}</a>
<a
key={idx}
href="#"
onClick={(e) => {
e.preventDefault();
onClick && typeof onClick === 'function' && onClick(e);
return false;
}}
{...others}
className={className}
>{label}</a>
);
});
}
Expand Down

0 comments on commit 8576b23

Please sign in to comment.