Merged
Conversation
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/README.md
Outdated
| | dotsSize | 下方翻页按钮大小 | string | `'normal'` | `'small'`, `'large'` | | ||
| | arrows | 是否显示两侧翻页按钮 | bool | `false` | `true`, `false` | | ||
| | arrowsType | 两侧箭头颜色 | string | `'dark'` | `'dark'`, `'light'` | | ||
| | onChange | 切换时回调函数 | func(current, prev) | `noop` | | |
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/Swiper.js
Outdated
|
|
||
| import SwiperDots from './SwiperDots'; | ||
|
|
||
| export default class Swiper extends Component { |
Contributor
There was a problem hiding this comment.
(PureComponent || Component)
cpylua
reviewed
Jun 7, 2017
site/src/nav.config.js
Outdated
| }, | ||
| { | ||
| path: 'component/swiper', | ||
| title: 'Swiper 幻灯片', |
cpylua
reviewed
Jun 7, 2017
| import React, { Component } from 'react'; | ||
| import cx from 'classnames'; | ||
|
|
||
| export default class SwiperDots extends Component { |
Contributor
There was a problem hiding this comment.
(PureComponent || Component)
cpylua
reviewed
Jun 7, 2017
| `${prefix}-swiper__dots-${dotsSize}` | ||
| ); | ||
|
|
||
| const clonedItems = [].slice.call(items); |
Contributor
There was a problem hiding this comment.
这里不需要单独建个数组吧,你直接遍历跳过0和length-1就行了吧。
这样做有些浪费。
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/Swiper.js
Outdated
| arrowsType: 'dark' | ||
| }; | ||
|
|
||
| static setStyle(target, styles) { |
Contributor
There was a problem hiding this comment.
这种函数就不要写在类上了,写成模块私有的函数就可以了,调用不是更方便嘛。
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/Swiper.js
Outdated
| this.setState({ | ||
| currentIndex: length - 1 | ||
| }), | ||
| 300 |
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/Swiper.js
Outdated
| /> | ||
| </div>} | ||
| <div | ||
| ref={swiperContainer => (this.swiperContainer = swiperContainer)} |
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/Swiper.js
Outdated
|
|
||
| init = (isFirstTime = true) => { | ||
| this.setSwiperWidth(); | ||
| this.setInnerElements(); |
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/Swiper.js
Outdated
| this.swiperWidth = this.swiper.getBoundingClientRect().width; | ||
| } | ||
|
|
||
| setInnerElements() { |
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/Swiper.js
Outdated
| const { autoplay } = this.props; | ||
| autoplay && this.startAutoplay(); | ||
| this.init(); | ||
| this.isFirstMounted = true; |
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/Swiper.js
Outdated
| currentIndex={currentIndex} | ||
| onDotsClick={this.handleDotsClick} | ||
| />} | ||
| <WindowResizeHandler onResize={this.init} /> |
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/README.md
Outdated
| | 参数 | 说明 | 类型 | 默认值 | 备选值 | | ||
| | --------------- | ---------------------------- | ------------------- | --------------- | ------------------------------------ | | ||
| | autoplay | 是否自动切换 | bool | `false` | `false`, `true` | | ||
| | autoplayIterval | 自动切换间隔时间(ms) | number | `3000` | | |
cpylua
reviewed
Jun 7, 2017
packages/zent/src/swiper/README.md
Outdated
| @@ -0,0 +1,138 @@ | |||
| ## Swiper 幻灯片 | |||
Contributor
Author
|
done |
cpylua
approved these changes
Jun 8, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #232
add new component: Swiper