mirror of
https://github.com/youzan/vant.git
synced 2026-05-06 01:00:26 +08:00
chore: add trailingComma
This commit is contained in:
@@ -30,13 +30,13 @@
|
||||
:style="{
|
||||
transform: `scale(${distance / 80})`
|
||||
}"
|
||||
>
|
||||
/>
|
||||
</template>
|
||||
<template #loosing>
|
||||
<img src="https://b.yzcdn.cn/vant/doge.png" class="doge">
|
||||
<img src="https://b.yzcdn.cn/vant/doge.png" class="doge" />
|
||||
</template>
|
||||
<template #loading>
|
||||
<img src="https://b.yzcdn.cn/vant/doge-fire.jpg" class="doge">
|
||||
<img src="https://b.yzcdn.cn/vant/doge-fire.jpg" class="doge" />
|
||||
</template>
|
||||
<p>{{ tips }}</p>
|
||||
</van-pull-refresh>
|
||||
@@ -53,21 +53,21 @@ export default {
|
||||
text: '刷新次数',
|
||||
success: '刷新成功',
|
||||
successTip: '成功提示',
|
||||
customTips: '自定义提示'
|
||||
customTips: '自定义提示',
|
||||
},
|
||||
'en-US': {
|
||||
try: 'Try it down',
|
||||
text: 'Refresh Count',
|
||||
success: 'Refresh success',
|
||||
successTip: 'Success Tip',
|
||||
customTips: 'Custom Tips'
|
||||
}
|
||||
customTips: 'Custom Tips',
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
count: 0,
|
||||
isLoading: false
|
||||
isLoading: false,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
}
|
||||
|
||||
return this.$t('try');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
@@ -104,8 +104,8 @@ export default {
|
||||
this.isLoading = false;
|
||||
this.count++;
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
+12
-12
@@ -20,27 +20,27 @@ export default createComponent({
|
||||
loadingText: String,
|
||||
value: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
successDuration: {
|
||||
type: Number,
|
||||
default: 500
|
||||
default: 500,
|
||||
},
|
||||
animationDuration: {
|
||||
type: Number,
|
||||
default: 300
|
||||
default: 300,
|
||||
},
|
||||
headHeight: {
|
||||
type: Number,
|
||||
default: DEFAULT_HEAD_HEIGHT
|
||||
}
|
||||
default: DEFAULT_HEAD_HEIGHT,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
status: 'normal',
|
||||
distance: 0,
|
||||
duration: 0
|
||||
duration: 0,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -54,10 +54,10 @@ export default createComponent({
|
||||
headStyle() {
|
||||
if (this.headHeight !== DEFAULT_HEAD_HEIGHT) {
|
||||
return {
|
||||
height: `${this.headHeight}px`
|
||||
height: `${this.headHeight}px`,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
@@ -71,7 +71,7 @@ export default createComponent({
|
||||
} else {
|
||||
this.setStatus(0, false);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
@@ -189,13 +189,13 @@ export default createComponent({
|
||||
setTimeout(() => {
|
||||
this.setStatus(0);
|
||||
}, this.successDuration);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
render() {
|
||||
const style = {
|
||||
transitionDuration: `${this.duration}ms`,
|
||||
transform: this.distance ? `translate3d(0,${this.distance}px, 0)` : ''
|
||||
transform: this.distance ? `translate3d(0,${this.distance}px, 0)` : '',
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -208,5 +208,5 @@ export default createComponent({
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -4,13 +4,13 @@ import { mount, later, trigger, triggerDrag } from '../../../test';
|
||||
test('change head content when pulling down', async () => {
|
||||
const wrapper = mount(PullRefresh, {
|
||||
propsData: {
|
||||
value: false
|
||||
value: false,
|
||||
},
|
||||
listeners: {
|
||||
input(value) {
|
||||
wrapper.setProps({ value });
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const track = wrapper.find('.van-pull-refresh__track');
|
||||
@@ -54,8 +54,8 @@ test('custom content by slots', async () => {
|
||||
},
|
||||
loading({ distance }) {
|
||||
return `loading ${distance}`;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const track = wrapper.find('.van-pull-refresh__track');
|
||||
@@ -78,8 +78,8 @@ test('custom content by slots', async () => {
|
||||
test('pull a short distance', () => {
|
||||
const wrapper = mount(PullRefresh, {
|
||||
propsData: {
|
||||
value: false
|
||||
}
|
||||
value: false,
|
||||
},
|
||||
});
|
||||
|
||||
const track = wrapper.find('.van-pull-refresh__track');
|
||||
@@ -90,8 +90,8 @@ test('pull a short distance', () => {
|
||||
test('not in page top', () => {
|
||||
const wrapper = mount(PullRefresh, {
|
||||
propsData: {
|
||||
value: false
|
||||
}
|
||||
value: false,
|
||||
},
|
||||
});
|
||||
|
||||
window.scrollTop = 100;
|
||||
@@ -109,13 +109,13 @@ test('render success text', async () => {
|
||||
const wrapper = mount(PullRefresh, {
|
||||
propsData: {
|
||||
successText: 'success',
|
||||
successDuration: 0
|
||||
successDuration: 0,
|
||||
},
|
||||
listeners: {
|
||||
input(value) {
|
||||
wrapper.setProps({ value });
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const track = wrapper.find('.van-pull-refresh__track');
|
||||
@@ -138,13 +138,13 @@ test('render success text', async () => {
|
||||
test('render success slot', async () => {
|
||||
const wrapper = mount(PullRefresh, {
|
||||
scopedSlots: {
|
||||
success: () => 'Custom Success'
|
||||
success: () => 'Custom Success',
|
||||
},
|
||||
listeners: {
|
||||
input(value) {
|
||||
wrapper.setProps({ value });
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const track = wrapper.find('.van-pull-refresh__track');
|
||||
@@ -160,8 +160,8 @@ test('render success slot', async () => {
|
||||
test('should set height when using head-height', async () => {
|
||||
const wrapper = mount(PullRefresh, {
|
||||
propsData: {
|
||||
headHeight: 100
|
||||
}
|
||||
headHeight: 100,
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
|
||||
Reference in New Issue
Block a user