Skip to content

Commit

Permalink
Merge pull request #322 from z2014/master
Browse files Browse the repository at this point in the history
fix: issue 320
  • Loading branch information
z2014 authored Jul 23, 2020
2 parents 232fb94 + dcc929b commit 494113a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
### CHANGELOG

#### 1.2.3

- fix: issue 320

#### 1.2.2

Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-weui",
"version": "1.2.2",
"version": "1.2.3",
"description": "weui for react",
"main": "./build/packages/index.js",
"scripts": {
Expand Down
18 changes: 16 additions & 2 deletions src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,29 @@ 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) => {
if (e) {
e.preventDefault();
}
if (onClick && typeof onClick === 'function') {
onClick(e);
}
return false;
}}
{...others}
className={className}
>{label}</a>
);
});
}
Expand Down

0 comments on commit 494113a

Please sign in to comment.