updated carousel style

This commit is contained in:
Rijn 2017-01-16 17:37:28 -06:00
parent 538b964bf9
commit 90f77e4060
3 changed files with 55 additions and 11 deletions

View file

@ -1,13 +1,20 @@
<template> <template>
<div :class="classes"> <div :class="classes">
<!-- button --> <div :class="[prefixCls + '-arrow', 'left']">
<div class='placeholder'></div>
<Icon type="arrow-left-b"></Icon>
</div>
<div :class="[prefixCls + '-list']"> <div :class="[prefixCls + '-list']">
<div :class="[prefixCls + '-track']" :style="trackStyles" v-el:slides> <div :class="[prefixCls + '-track']" :style="trackStyles" v-el:slides>
<!-- opacity: 1; width: 4480px; transform: translate3d(-1120px, 0px, 0px); --> <!-- opacity: 1; width: 4480px; transform: translate3d(-1120px, 0px, 0px); -->
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
<!-- button --> <div :class="[prefixCls + '-arrow', 'right']">
<div class='placeholder'></div>
<Icon type="arrow-right-b"></Icon>
</div>
<!-- dots -->
</div> </div>
</template> </template>
<script> <script>
@ -39,10 +46,6 @@
type: Boolean, type: Boolean,
default: true default: true
}, },
fade: {
type: Boolean,
default: false
},
vertical: { vertical: {
type: Boolean, type: Boolean,
default: false default: false
@ -122,8 +125,6 @@
}); });
this.slides = slides; this.slides = slides;
// this.updateSlideWidth();
}, },
updatePos () { updatePos () {
this.findChild((child) => { this.findChild((child) => {

View file

@ -29,6 +29,8 @@
display: block; display: block;
overflow: hidden; overflow: hidden;
z-index: 1;
} }
&-item { &-item {
@ -37,4 +39,42 @@
min-height: 1px; min-height: 1px;
display: block; display: block;
} }
&-arrow {
position: absolute;
top: 0;
bottom: 0;
height: 100%;
text-align: center;
& > * {
display: inline-block;
vertical-align: middle;
}
.placeholder{
overflow: hidden;
width: 0;
min-height: inherit;
height: inherit;
}
z-index: 3;
&.left {
left: 0;
}
&.right {
right: 0;
}
width: 10%;
cursor: pointer;
&:hover {
background: fade(#000, 30%);
}
}
} }

View file

@ -12,10 +12,11 @@
Speed <Slider :value.sync="autoplaySpeed" :min="300" :max="5000"></Slider> Speed <Slider :value.sync="autoplaySpeed" :min="300" :max="5000"></Slider>
</i-col> </i-col>
</Row> </Row>
<Carousel style="width: 400px" <Carousel style="width: 50%; border: solid 1px #000"
:current-index.sync="currentIndex" :current-index.sync="currentIndex"
:autoplay="autoplay" :autoplay="autoplay"
:autoplay-speed="autoplaySpeed"> :autoplay-speed="autoplaySpeed"
easing="linear">
<Carousel-item> <Carousel-item>
<Alert type="warning" show-icon> <Alert type="warning" show-icon>
警告提示文案 警告提示文案
@ -24,7 +25,9 @@
</template> </template>
</Alert> </Alert>
</Carousel-item> </Carousel-item>
<Carousel-item>test2</Carousel-item> <Carousel-item style="text-align: center">
<Icon type="checkmark" style="font-size: 5em"></Icon>
</Carousel-item>
<Carousel-item>test3</Carousel-item> <Carousel-item>test3</Carousel-item>
</Carousel> </Carousel>
</template> </template>