Bug fixed #6076
This commit is contained in:
parent
e8f22ea094
commit
68ff748436
3 changed files with 73 additions and 31 deletions
|
@ -1,39 +1,79 @@
|
||||||
<style>
|
|
||||||
.demo-carousel{
|
|
||||||
height: 200px;
|
|
||||||
line-height: 200px;
|
|
||||||
text-align: center;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 20px;
|
|
||||||
background: #506b9e;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<template>
|
<template>
|
||||||
<div style="width: 400px;">
|
<div>
|
||||||
<Carousel v-model="value1" loop arrow="always" @on-change="handleChange" @on-click="handlerClick">
|
<!--#6076-->
|
||||||
<CarouselItem v-for="it in 4" :key="it">
|
<Carousel loop>
|
||||||
<div class="demo-carousel">
|
<CarouselItem>
|
||||||
{{it}}
|
<div class="demo-carousel">111111111111</div>
|
||||||
</div>
|
</CarouselItem>
|
||||||
|
<CarouselItem>
|
||||||
|
<div class="demo-carousel">2</div>
|
||||||
|
</CarouselItem>
|
||||||
|
<CarouselItem>
|
||||||
|
<div class="demo-carousel">3</div>
|
||||||
|
</CarouselItem>
|
||||||
|
<CarouselItem>
|
||||||
|
<div class="demo-carousel">4</div>
|
||||||
</CarouselItem>
|
</CarouselItem>
|
||||||
</Carousel>
|
</Carousel>
|
||||||
<Button @click="value1 = 2">change</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
value1: 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleChange (old, newval) {
|
|
||||||
console.log(old, newval,'---on-change');
|
|
||||||
},
|
|
||||||
handlerClick(index){
|
|
||||||
console.log(index,'------on-click');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style>
|
||||||
|
.demo-carousel{
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!--<style>-->
|
||||||
|
<!-- .demo-carousel{-->
|
||||||
|
<!-- height: 200px;-->
|
||||||
|
<!-- line-height: 200px;-->
|
||||||
|
<!-- text-align: center;-->
|
||||||
|
<!-- font-size: 20px;-->
|
||||||
|
<!-- }-->
|
||||||
|
<!--</style>-->
|
||||||
|
<!--<template>-->
|
||||||
|
<!-- <div>-->
|
||||||
|
<!-- <Carousel v-model="value1" loop @on-change="handleChange" @on-click="handlerClick">-->
|
||||||
|
<!-- <CarouselItem v-for="it in 4" :key="it">-->
|
||||||
|
<!-- <div class="demo-carousel">-->
|
||||||
|
<!-- {{it}}<Button @click="handlerIndexClick(it)">点击事件</Button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </CarouselItem>-->
|
||||||
|
<!-- </Carousel>-->
|
||||||
|
<!-- <Button @click="value1 = 2">change</Button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!--</template>-->
|
||||||
|
<!--<script>-->
|
||||||
|
<!-- export default {-->
|
||||||
|
<!-- data () {-->
|
||||||
|
<!-- return {-->
|
||||||
|
<!-- value1: 0-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- },-->
|
||||||
|
<!-- methods: {-->
|
||||||
|
<!-- handleChange (old, newval) {-->
|
||||||
|
<!-- console.log(old, newval,'---on-change');-->
|
||||||
|
<!-- },-->
|
||||||
|
<!-- handlerClick(index){-->
|
||||||
|
<!-- console.log(index,'------on-click');-->
|
||||||
|
<!-- },-->
|
||||||
|
<!-- handlerIndexClick(it){-->
|
||||||
|
<!-- console.log(it,'------it')-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- },-->
|
||||||
|
<!-- }-->
|
||||||
|
<!--</script>-->
|
||||||
|
|
|
@ -113,10 +113,13 @@
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
trackStyles () {
|
trackStyles () {
|
||||||
|
// #6076
|
||||||
|
const visibleStyle = this.trackIndex === -1 ? 'hidden' : 'visible';
|
||||||
return {
|
return {
|
||||||
width: `${this.trackWidth}px`,
|
width: `${this.trackWidth}px`,
|
||||||
transform: `translate3d(${-this.trackOffset}px, 0px, 0px)`,
|
transform: `translate3d(${-this.trackOffset}px, 0px, 0px)`,
|
||||||
transition: `transform 500ms ${this.easing}`
|
transition: `transform 500ms ${this.easing}`,
|
||||||
|
visibility : visibleStyle
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
copyTrackStyles () {
|
copyTrackStyles () {
|
||||||
|
@ -125,7 +128,7 @@
|
||||||
transform: `translate3d(${-this.trackCopyOffset}px, 0px, 0px)`,
|
transform: `translate3d(${-this.trackCopyOffset}px, 0px, 0px)`,
|
||||||
transition: `transform 500ms ${this.easing}`,
|
transition: `transform 500ms ${this.easing}`,
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 0
|
//top: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
arrowClasses () {
|
arrowClasses () {
|
||||||
|
@ -198,8 +201,8 @@
|
||||||
child.width = this.listWidth;
|
child.width = this.listWidth;
|
||||||
child.height = typeof this.height === 'number' ? `${this.height}px` : this.height;
|
child.height = typeof this.height === 'number' ? `${this.height}px` : this.height;
|
||||||
});
|
});
|
||||||
|
const slidesLength = this.slides.length || 0
|
||||||
this.trackWidth = (this.slides.length || 0) * this.listWidth;
|
this.trackWidth = slidesLength * this.listWidth;
|
||||||
},
|
},
|
||||||
// use when slot changed
|
// use when slot changed
|
||||||
slotChange () {
|
slotChange () {
|
||||||
|
|
|
@ -24,15 +24,14 @@
|
||||||
|
|
||||||
&-track {
|
&-track {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 0;
|
top: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
&.higher {
|
&.higher {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue