Commit 41f83010fa023848550ab68e853461ec5eee7c02

Authored by Rijn
1 parent 6c9acb08

update props and events

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
... ... @@ -34,4 +34,5 @@
34 34 @import "menu";
35 35 @import "date-picker";
36 36 @import "time-picker";
37   -@import "form";
38 37 \ No newline at end of file
  38 +@import "form";
  39 +@import "carousel";
39 40 \ No newline at end of file
... ...
test/routers/carousel.vue
1 1 <template>
2 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 9 <Carousel-item></Carousel-item>
4 10 </Carousel>
5 11 </template>
... ...