Skip to content

Commit

Permalink
Album.show添加onChange、onClose方法
Browse files Browse the repository at this point in the history
  • Loading branch information
顺堂 committed Oct 30, 2018
1 parent 5c53c0e commit b5bd74b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ Yes please! See the [CONTRIBUTING](https://github.com/uxcore/uxcore/blob/master/

With this method, the component can be used by calling `Album.show({src: 'foo/url'})` or `Album.show({photos: [<Photo src="#url1" />, <Photo src="#url2" />]})` directly.


#### config

| Name | Type | Required | Default | Comments |
Expand Down
6 changes: 3 additions & 3 deletions demo/AlbumDemo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ export default class Demo extends React.Component {
thumbPlacement="right"
thumbBackground="#000"
ref={(album) => { this.album = album; }}
// onChange={(index) => { console.log('onChange', index); }}
// onOpen={(index) => { console.log('onOpen', index); }}
// onClose={() => { console.log('onClose'); }}
onChange={(index) => { console.log('onChange', index); }}
onOpen={(index) => { console.log('onOpen', index); }}
onClose={() => { console.log('onClose'); }}
>
<Photo
src="//img.alicdn.com/imgextra/i2/927018118/TB13fBjKFXXXXbPXpXXXXXXXXXX_!!0-tstar.jpg"
Expand Down
4 changes: 2 additions & 2 deletions src/Album.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ Album.show = (option = {}) => {
if (typeof config.onChange === 'function') {
config.onChange(index);
}
}
};

/**
* 关闭
Expand All @@ -369,7 +369,7 @@ Album.show = (option = {}) => {
if (typeof config.onClose === 'function') {
config.onClose();
}
}
};

const prefixCls = option.prefixCls || 'kuma-uxcore-album';

Expand Down
1 change: 1 addition & 0 deletions src/Carousel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Carousel extends React.Component {
inView: false,
}


static propTypes = {
children: PropTypes.any,
current: PropTypes.number,
Expand Down
1 change: 0 additions & 1 deletion src/Photo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Photo.defaultProps = {
src: '',
};


// http://facebook.github.io/react/docs/reusable-components.html
Photo.propTypes = {
src: PropTypes.string,
Expand Down
4 changes: 4 additions & 0 deletions src/Viewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ class Viewer extends React.Component {
}, this.handleChange.bind(this));
}

/**
* 变化时
* @param {Number} index
*/
handleChange(index) {
const { onChange } = this.props;
let { current } = this.state;
Expand Down

0 comments on commit b5bd74b

Please sign in to comment.