增加space属性
parent
1e70f5302f
commit
f921d5bd26
|
@ -55,7 +55,7 @@ class Swipe extends Component {
|
|||
},
|
||||
arrow: {
|
||||
type: String,
|
||||
default: 'hover' // hover or alway
|
||||
default: 'hover' // hover or alway or none
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
|
@ -73,6 +73,10 @@ class Swipe extends Component {
|
|||
pauseOnHover: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
space: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,6 +149,7 @@ class Swipe extends Component {
|
|||
right: 3%;
|
||||
}
|
||||
.indicator {
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
@ -323,7 +328,7 @@ class Swipe extends Component {
|
|||
})
|
||||
|
||||
let toggleBtns =
|
||||
this.direction === 'horizontal'
|
||||
this.arrow !== 'none' && this.direction === 'horizontal'
|
||||
? html`
|
||||
<div class="left toggle-btn" style=${styles} @click=${this.prev}>
|
||||
<wc-icon name="left"></wc-icon>
|
||||
|
@ -446,9 +451,16 @@ class SwipeItem extends Component {
|
|||
}
|
||||
|
||||
calcCardTranslate(index, activeIndex) {
|
||||
let space = 0
|
||||
if (this.$parent.space) {
|
||||
space = 0.66 + +this.$parent.space / 100
|
||||
}
|
||||
const parentWidth = this.$parent.offsetWidth
|
||||
if (this.inStage) {
|
||||
return (parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1)) / 4
|
||||
return (
|
||||
(parentWidth * ((2 + space - CARD_SCALE) * (index - activeIndex) + 1)) /
|
||||
4
|
||||
)
|
||||
} else if (index < activeIndex) {
|
||||
return (-(1 + CARD_SCALE) * parentWidth) / 4
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue