Carousel: apply infinite sliding in non-card mode (#2622)

pull/2672/head
杨奕 2017-02-04 18:35:09 +08:00 committed by baiyaaaaa
parent 58195fc69d
commit 7628fc0e41
3 changed files with 8 additions and 5 deletions

View File

@ -70,11 +70,10 @@
translateItem(index, activeIndex) {
const parentWidth = this.$parent.$el.offsetWidth;
const length = this.$parent.items.length;
if (index !== activeIndex && length > 2) {
index = this.processIndex(index, activeIndex, length);
}
if (this.$parent.type === 'card') {
if (index !== activeIndex && length > 2) {
index = this.processIndex(index, activeIndex, length);
}
this.inStage = Math.round(Math.abs(index - activeIndex)) <= 1;
this.active = index === activeIndex;
this.translate = this.calculateTranslate(index, activeIndex, parentWidth);

View File

@ -13,10 +13,13 @@
display: inline-block;
transition: .4s ease-in-out;
overflow: hidden;
z-index: calc(var(--index-normal) - 1);
@when active {
z-index: calc(var(--index-normal) + 1);
}
@modifier card {
width: 50%;
z-index: calc(var(--index-normal) - 1);
&.is-in-stage {
cursor: pointer;
z-index: var(--index-normal);

View File

@ -55,6 +55,7 @@
transform: translateX(-50%);
margin: 0;
padding: 0;
z-index: calc(var(--index-normal) + 1);
@modifier outside {
bottom: calc(var(--carousel-indicator-height) + var(--carousel-indicator-padding-vertical) * 2);