mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-24 02:16:12 +08:00
[improvement] Swipe: can set cross axis size (#1982)
This commit is contained in:
parent
28d380f25a
commit
bf8ce57e42
@ -36,16 +36,10 @@ export default create({
|
|||||||
mixins: [Touch],
|
mixins: [Touch],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
width: Number,
|
||||||
|
height: Number,
|
||||||
autoplay: Number,
|
autoplay: Number,
|
||||||
vertical: Boolean,
|
vertical: Boolean,
|
||||||
width: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
height: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
loop: {
|
loop: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
@ -137,8 +131,11 @@ export default create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
trackStyle() {
|
trackStyle() {
|
||||||
|
const mainAxis = this.vertical ? 'height' : 'width';
|
||||||
|
const crossAxis = this.vertical ? 'width' : 'height';
|
||||||
return {
|
return {
|
||||||
[this.vertical ? 'height' : 'width']: `${this.trackSize}px`,
|
[mainAxis]: `${this.trackSize}px`,
|
||||||
|
[crossAxis]: this[crossAxis] ? `${this[crossAxis]}px` : '',
|
||||||
transitionDuration: `${this.swiping ? 0 : this.duration}ms`,
|
transitionDuration: `${this.swiping ? 0 : this.duration}ms`,
|
||||||
transform: `translate${this.vertical ? 'Y' : 'X'}(${this.offset}px)`
|
transform: `translate${this.vertical ? 'Y' : 'X'}(${this.offset}px)`
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user