Skip to content

Commit 494113a

Browse files
authored
Merge pull request #322 from z2014/master
fix: issue 320
2 parents 232fb94 + dcc929b commit 494113a

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### CHANGELOG
22

3+
#### 1.2.3
4+
5+
- fix: issue 320
6+
37
#### 1.2.2
48

59
Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-weui",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "weui for react",
55
"main": "./build/packages/index.js",
66
"scripts": {

src/components/dialog/dialog.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,29 @@ class Dialog extends Component {
4848

4949
renderButtons() {
5050
return this.props.buttons.map((action, idx) => {
51-
const {type, label, ...others} = action;
51+
const {type, label, onClick, ...others} = action;
5252
const className = classNames({
5353
'weui-dialog__btn': true,
5454
'weui-dialog__btn_default': type === 'default',
5555
'weui-dialog__btn_primary': type === 'primary'
5656
});
5757

5858
return (
59-
<a key={idx} href="javascript:;" {...others} className={className}>{label}</a>
59+
<a
60+
key={idx}
61+
href="#"
62+
onClick={(e) => {
63+
if (e) {
64+
e.preventDefault();
65+
}
66+
if (onClick && typeof onClick === 'function') {
67+
onClick(e);
68+
}
69+
return false;
70+
}}
71+
{...others}
72+
className={className}
73+
>{label}</a>
6074
);
6175
});
6276
}

0 commit comments

Comments
 (0)