mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-11-04 12:52:08 +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],
 | 
			
		||||
 | 
			
		||||
  props: {
 | 
			
		||||
    width: Number,
 | 
			
		||||
    height: Number,
 | 
			
		||||
    autoplay: Number,
 | 
			
		||||
    vertical: Boolean,
 | 
			
		||||
    width: {
 | 
			
		||||
      type: Number,
 | 
			
		||||
      default: 0
 | 
			
		||||
    },
 | 
			
		||||
    height: {
 | 
			
		||||
      type: Number,
 | 
			
		||||
      default: 0
 | 
			
		||||
    },
 | 
			
		||||
    loop: {
 | 
			
		||||
      type: Boolean,
 | 
			
		||||
      default: true
 | 
			
		||||
@ -137,8 +131,11 @@ export default create({
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    trackStyle() {
 | 
			
		||||
      const mainAxis = this.vertical ? 'height' : 'width';
 | 
			
		||||
      const crossAxis = this.vertical ? 'width' : 'height';
 | 
			
		||||
      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`,
 | 
			
		||||
        transform: `translate${this.vertical ? 'Y' : 'X'}(${this.offset}px)`
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user