fix Carousel style bug

https://github.com/iview/iview/issues/6076
This commit is contained in:
梁灏 2019-12-16 09:56:03 +08:00
parent bfb6931364
commit 01a4abe8ce
2 changed files with 8 additions and 3 deletions

View file

@ -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 () {

View file

@ -24,7 +24,8 @@
&-track { &-track {
position: relative; position: relative;
top: 0; //top: 0;
top: 100%;
left: 0; left: 0;
display: block; display: block;
@ -33,6 +34,7 @@
z-index: 1; z-index: 1;
&.higher { &.higher {
z-index: 2; z-index: 2;
top: 0;
} }
} }