Commit 41f83010fa023848550ab68e853461ec5eee7c02
1 parent
6c9acb08
update props and events
Showing
4 changed files
with
61 additions
and
5 deletions
Show diff stats
src/components/carousel/carousel.vue
| 1 | 1 | <template> |
| 2 | - <div :class="prefixCls"> | |
| 2 | + <div :class="classes"> | |
| 3 | + <slot></slot> | |
| 3 | 4 | </div> |
| 4 | 5 | </template> |
| 5 | 6 | <script> |
| 6 | - const prefixCls = 'ivu-cascader'; | |
| 7 | + import Icon from '../icon/icon.vue'; | |
| 8 | + | |
| 9 | + const prefixCls = 'ivu-carousel'; | |
| 7 | 10 | |
| 8 | 11 | export default { |
| 9 | - name: 'Carousel' | |
| 12 | + name: 'Carousel', | |
| 13 | + props: { | |
| 14 | + arrows: { | |
| 15 | + type: Boolean, | |
| 16 | + default: false | |
| 17 | + }, | |
| 18 | + autoplay: { | |
| 19 | + type: Boolean, | |
| 20 | + default: true | |
| 21 | + }, | |
| 22 | + autoplaySpeed: { | |
| 23 | + type: Number, | |
| 24 | + default: 2000 | |
| 25 | + }, | |
| 26 | + easing: { | |
| 27 | + type: String, | |
| 28 | + default: 'ease' | |
| 29 | + }, | |
| 30 | + dots: { | |
| 31 | + type: Boolean, | |
| 32 | + default: true | |
| 33 | + }, | |
| 34 | + fade: { | |
| 35 | + type: Boolean, | |
| 36 | + default: false | |
| 37 | + }, | |
| 38 | + vertical: { | |
| 39 | + type: Boolean, | |
| 40 | + default: false | |
| 41 | + } | |
| 42 | + }, | |
| 43 | + // events: before-change(from, to), after-change(current, from) | |
| 44 | + computed: { | |
| 45 | + classes () { | |
| 46 | + return [ | |
| 47 | + `${prefixCls}`, | |
| 48 | + { | |
| 49 | + [`${prefixCls}-vertical`]: this.vertical | |
| 50 | + } | |
| 51 | + ]; | |
| 52 | + } | |
| 53 | + } | |
| 10 | 54 | }; |
| 11 | 55 | </script> | ... | ... |
src/styles/components/carousel.less
| ... | ... | @@ -2,5 +2,10 @@ |
| 2 | 2 | @carousel-item-prefix-cls: ~"@{css-prefix}carousel-item"; |
| 3 | 3 | |
| 4 | 4 | .@{carousel-prefix-cls} { |
| 5 | - | |
| 5 | + position: relative; | |
| 6 | + display: block; | |
| 7 | + box-sizing: border-box; | |
| 8 | + user-select: none; | |
| 9 | + touch-action: pan-y; | |
| 10 | + -webkit-tap-highlight-color: transparent; | |
| 6 | 11 | } | ... | ... |
src/styles/components/index.less
test/routers/carousel.vue