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 | <template> | 1 | <template> |
2 | - <div :class="prefixCls"> | 2 | + <div :class="classes"> |
3 | + <slot></slot> | ||
3 | </div> | 4 | </div> |
4 | </template> | 5 | </template> |
5 | <script> | 6 | <script> |
6 | - const prefixCls = 'ivu-cascader'; | 7 | + import Icon from '../icon/icon.vue'; |
8 | + | ||
9 | + const prefixCls = 'ivu-carousel'; | ||
7 | 10 | ||
8 | export default { | 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 | </script> | 55 | </script> |
src/styles/components/carousel.less
@@ -2,5 +2,10 @@ | @@ -2,5 +2,10 @@ | ||
2 | @carousel-item-prefix-cls: ~"@{css-prefix}carousel-item"; | 2 | @carousel-item-prefix-cls: ~"@{css-prefix}carousel-item"; |
3 | 3 | ||
4 | .@{carousel-prefix-cls} { | 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
@@ -34,4 +34,5 @@ | @@ -34,4 +34,5 @@ | ||
34 | @import "menu"; | 34 | @import "menu"; |
35 | @import "date-picker"; | 35 | @import "date-picker"; |
36 | @import "time-picker"; | 36 | @import "time-picker"; |
37 | -@import "form"; | ||
38 | \ No newline at end of file | 37 | \ No newline at end of file |
38 | +@import "form"; | ||
39 | +@import "carousel"; | ||
39 | \ No newline at end of file | 40 | \ No newline at end of file |
test/routers/carousel.vue
1 | <template> | 1 | <template> |
2 | <Carousel> | 2 | <Carousel> |
3 | + <Carousel-item>test1</Carousel-item> | ||
4 | + <Carousel-item>test2</Carousel-item> | ||
5 | + <Carousel-item>test3</Carousel-item> | ||
6 | + </Carousel> | ||
7 | + | ||
8 | + <Carousel :vertical="true"> | ||
3 | <Carousel-item></Carousel-item> | 9 | <Carousel-item></Carousel-item> |
4 | </Carousel> | 10 | </Carousel> |
5 | </template> | 11 | </template> |