Skip to content

Commit

Permalink
Merge 253822e into 232fb94
Browse files Browse the repository at this point in the history
  • Loading branch information
z2014 authored Jul 22, 2020
2 parents 232fb94 + 253822e commit 5d77061
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,27 @@ 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();
if (onClick && typeof onClick === 'function') {
onClick(e);
}
return false;
}}
{...others}
className={className}
>{label}</a>
);
});
}
Expand Down

0 comments on commit 5d77061

Please sign in to comment.