chore: add trailingComma
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<demo-block :title="$t('title2')">
|
||||
<van-swipe :autoplay="3000">
|
||||
<van-swipe-item v-for="(image, index) in images" :key="index">
|
||||
<img v-lazy="image">
|
||||
<img v-lazy="image" />
|
||||
</van-swipe-item>
|
||||
</van-swipe>
|
||||
</demo-block>
|
||||
@@ -74,7 +74,7 @@ export default {
|
||||
title4: '纵向滚动',
|
||||
title5: '自定义滑块大小',
|
||||
title6: '自定义指示器',
|
||||
message: '当前 Swipe 索引:'
|
||||
message: '当前 Swipe 索引:',
|
||||
},
|
||||
'en-US': {
|
||||
title2: 'Image Lazyload',
|
||||
@@ -82,8 +82,8 @@ export default {
|
||||
title4: 'Vertical Scrolling',
|
||||
title5: 'Set SwipeItem Size',
|
||||
title6: 'Custom indicator',
|
||||
message: 'Current Swipe index:'
|
||||
}
|
||||
message: 'Current Swipe index:',
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -93,8 +93,8 @@ export default {
|
||||
'https://img.yzcdn.cn/vant/apple-1.jpg',
|
||||
'https://img.yzcdn.cn/vant/apple-2.jpg',
|
||||
'https://img.yzcdn.cn/vant/apple-3.jpg',
|
||||
'https://img.yzcdn.cn/vant/apple-4.jpg'
|
||||
]
|
||||
'https://img.yzcdn.cn/vant/apple-4.jpg',
|
||||
],
|
||||
};
|
||||
},
|
||||
|
||||
@@ -105,8 +105,8 @@ export default {
|
||||
|
||||
onChange2(index) {
|
||||
this.current = index;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
+19
-19
@@ -19,7 +19,7 @@ export default createComponent({
|
||||
} else {
|
||||
this.clear();
|
||||
}
|
||||
})
|
||||
}),
|
||||
],
|
||||
|
||||
props: {
|
||||
@@ -30,28 +30,28 @@ export default createComponent({
|
||||
indicatorColor: String,
|
||||
loop: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 500
|
||||
default: 500,
|
||||
},
|
||||
touchable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
initialSwipe: {
|
||||
type: Number,
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
showIndicators: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
stopPropagation: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -63,7 +63,7 @@ export default createComponent({
|
||||
deltaX: 0,
|
||||
deltaY: 0,
|
||||
swipes: [],
|
||||
swiping: false
|
||||
swiping: false,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -82,7 +82,7 @@ export default createComponent({
|
||||
} else {
|
||||
this.autoPlay();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
@@ -119,13 +119,13 @@ export default createComponent({
|
||||
[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)`
|
||||
transform: `translate${this.vertical ? 'Y' : 'X'}(${this.offset}px)`,
|
||||
};
|
||||
},
|
||||
|
||||
indicatorStyle() {
|
||||
return {
|
||||
backgroundColor: this.indicatorColor
|
||||
backgroundColor: this.indicatorColor,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -134,7 +134,7 @@ export default createComponent({
|
||||
return (
|
||||
(this.vertical ? rect.height : rect.width) - this.size * this.count
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
@@ -200,7 +200,7 @@ export default createComponent({
|
||||
const offset = this.vertical ? this.offsetY : this.offsetX;
|
||||
this.move({
|
||||
pace: offset > 0 ? (this.delta > 0 ? -1 : 1) : 0,
|
||||
emitChange: true
|
||||
emitChange: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ export default createComponent({
|
||||
this.swiping = false;
|
||||
this.move({
|
||||
pace: -1,
|
||||
emitChange: true
|
||||
emitChange: true,
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -290,7 +290,7 @@ export default createComponent({
|
||||
this.swiping = false;
|
||||
this.move({
|
||||
pace: 1,
|
||||
emitChange: true
|
||||
emitChange: true,
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -318,7 +318,7 @@ export default createComponent({
|
||||
|
||||
this.move({
|
||||
pace: targetIndex - this.active,
|
||||
emitChange: true
|
||||
emitChange: true,
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -371,7 +371,7 @@ export default createComponent({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
render() {
|
||||
@@ -383,5 +383,5 @@ export default createComponent({
|
||||
{this.genIndicator()}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -8,10 +8,10 @@ snapshotDemo(Demo, {
|
||||
beforeTest: () => {
|
||||
restore = mockGetBoundingClientRect({
|
||||
width: 100,
|
||||
height: 100
|
||||
height: 100,
|
||||
});
|
||||
},
|
||||
afterTest: () => {
|
||||
restore();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ function mockPageHidden() {
|
||||
let hidden = true;
|
||||
|
||||
Object.defineProperty(document, 'hidden', {
|
||||
get: () => hidden
|
||||
get: () => hidden,
|
||||
});
|
||||
|
||||
trigger(window, 'visibilitychange');
|
||||
@@ -23,29 +23,29 @@ const Component = {
|
||||
vertical: Boolean,
|
||||
loop: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
touchable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
autoplay: {
|
||||
type: Number,
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
initialSwipe: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
style: {
|
||||
width: '100px',
|
||||
height: '100px'
|
||||
}
|
||||
height: '100px',
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
test('swipeTo method', async () => {
|
||||
@@ -61,7 +61,7 @@ test('swipeTo method with immediate option', async () => {
|
||||
const wrapper = mount(Component);
|
||||
const { swipe } = wrapper.vm.$refs;
|
||||
swipe.swipeTo(2, {
|
||||
immediate: true
|
||||
immediate: true,
|
||||
});
|
||||
|
||||
await later(100);
|
||||
@@ -93,8 +93,8 @@ test('initial swipe', () => {
|
||||
test('vertical swipe', () => {
|
||||
const wrapper = mount(Component, {
|
||||
propsData: {
|
||||
vertical: true
|
||||
}
|
||||
vertical: true,
|
||||
},
|
||||
});
|
||||
const { swipe } = wrapper.vm.$refs;
|
||||
const track = wrapper.find('.van-swipe__track');
|
||||
@@ -106,8 +106,8 @@ test('vertical swipe', () => {
|
||||
test('untouchable', () => {
|
||||
const wrapper = mount(Component, {
|
||||
propsData: {
|
||||
touchable: false
|
||||
}
|
||||
touchable: false,
|
||||
},
|
||||
});
|
||||
const { swipe } = wrapper.vm.$refs;
|
||||
const track = wrapper.find('.van-swipe__track');
|
||||
@@ -140,8 +140,8 @@ test('loop', () => {
|
||||
test('not loop', () => {
|
||||
const wrapper = mount(Component, {
|
||||
propsData: {
|
||||
loop: false
|
||||
}
|
||||
loop: false,
|
||||
},
|
||||
});
|
||||
const { swipe } = wrapper.vm.$refs;
|
||||
const track = wrapper.find('.van-swipe__track');
|
||||
@@ -159,11 +159,11 @@ test('should pause auto play when page hidden', async () => {
|
||||
mount(Component, {
|
||||
propsData: {
|
||||
loop: true,
|
||||
autoplay: 1
|
||||
autoplay: 1,
|
||||
},
|
||||
listeners: {
|
||||
change
|
||||
}
|
||||
change,
|
||||
},
|
||||
});
|
||||
|
||||
mockPageHidden();
|
||||
|
||||
Reference in New Issue
Block a user