chore: add trailingComma

This commit is contained in:
陈嘉涵
2020-01-19 11:57:09 +08:00
parent e841175fe8
commit 389d68884d
269 changed files with 2706 additions and 2702 deletions
+9 -9
View File
@@ -19,25 +19,25 @@ export default createComponent({
message: [Number, String],
type: {
type: String,
default: 'text'
default: 'text',
},
position: {
type: String,
default: 'middle'
default: 'middle',
},
transition: {
type: String,
default: 'van-fade'
default: 'van-fade',
},
lockScroll: {
type: Boolean,
default: false
}
default: false,
},
},
data() {
return {
clickable: false
clickable: false,
};
},
@@ -51,7 +51,7 @@ export default createComponent({
watch: {
value: 'toggleClickable',
forbidClick: 'toggleClickable'
forbidClick: 'toggleClickable',
},
methods: {
@@ -108,7 +108,7 @@ export default createComponent({
}
return <div class={bem('text')}>{message}</div>;
}
},
},
render() {
@@ -128,5 +128,5 @@ export default createComponent({
</div>
</transition>
);
}
},
});
+9 -9
View File
@@ -44,7 +44,7 @@ export default {
text4: second => `倒计时 ${second}`,
longTextButton: '长文字提示',
updateMessage: '动态更新提示',
loadingType: '自定义加载图标'
loadingType: '自定义加载图标',
},
'en-US': {
title1: 'Text',
@@ -61,8 +61,8 @@ export default {
text4: second => `${second} seconds`,
longTextButton: 'Long Text',
updateMessage: 'Update Message',
loadingType: 'Loading Type'
}
loadingType: 'Loading Type',
},
},
methods: {
@@ -70,7 +70,7 @@ export default {
this.$toast.loading({
forbidClick: true,
message: this.$t('loading'),
loadingType
loadingType,
});
},
@@ -85,14 +85,14 @@ export default {
showIconToast() {
this.$toast({
message: this.$t('customIcon'),
icon: 'like-o'
icon: 'like-o',
});
},
showImageToast() {
this.$toast({
message: this.$t('customImage'),
icon: 'https://img.yzcdn.cn/vant/logo.png'
icon: 'https://img.yzcdn.cn/vant/logo.png',
});
},
@@ -100,7 +100,7 @@ export default {
const toast = this.$toast.loading({
duration: 0,
forbidClick: true,
message: this.$t('text4', 3)
message: this.$t('text4', 3),
});
let second = 3;
@@ -113,8 +113,8 @@ export default {
this.$toast.clear();
}
}, 1000);
}
}
},
},
};
</script>
+6 -6
View File
@@ -22,7 +22,7 @@ const defaultOptions = {
getContainer: 'body',
overlayStyle: null,
closeOnClick: false,
closeOnClickOverlay: false
closeOnClickOverlay: false,
};
// default options of specific type
@@ -31,7 +31,7 @@ let defaultOptionsMap = {};
let queue = [];
let multiple = false;
let currentOptions = {
...defaultOptions
...defaultOptions,
};
function parseOptions(message) {
@@ -50,7 +50,7 @@ function createInstance() {
if (!queue.length || multiple) {
const toast = new (Vue.extend(VueToast))({
el: document.createElement('div')
el: document.createElement('div'),
});
toast.$on('input', value => {
@@ -69,7 +69,7 @@ function transformOptions(options) {
...options,
overlay: options.mask || options.overlay,
mask: undefined,
duration: undefined
duration: undefined,
};
}
@@ -85,7 +85,7 @@ function Toast(options = {}) {
options = {
...currentOptions,
...defaultOptionsMap[options.type || currentOptions.type],
...options
...options,
};
options.clear = () => {
@@ -125,7 +125,7 @@ function Toast(options = {}) {
const createMethod = type => options =>
Toast({
type,
...parseOptions(options)
...parseOptions(options),
});
['loading', 'success', 'fail'].forEach(method => {
+9 -9
View File
@@ -7,7 +7,7 @@ import { lockClick } from '../lock-click';
test('create a forbidClick toast', async () => {
const toast = Toast({
forbidClick: true,
type: 'success'
type: 'success',
});
await later();
@@ -27,7 +27,7 @@ test('create a forbidClick toast', async () => {
it('toast disappeared after duration', async () => {
const toast = Toast({
duration: 10
duration: 10,
});
await later(50);
@@ -36,7 +36,7 @@ it('toast disappeared after duration', async () => {
test('show loading toast', async () => {
const toast = Toast.loading({
message: 'Message'
message: 'Message',
});
await later();
@@ -46,7 +46,7 @@ test('show loading toast', async () => {
test('show html toast', async () => {
const toast = Toast({
type: 'html',
message: '<div>Message</div>'
message: '<div>Message</div>',
});
await later();
@@ -56,7 +56,7 @@ test('show html toast', async () => {
test('icon prop', async () => {
const toast = Toast({
message: 'Message',
icon: 'star-o'
icon: 'star-o',
});
await later();
@@ -67,7 +67,7 @@ test('icon-prefix prop', async () => {
const toast = Toast({
message: 'Message',
icon: 'star-o',
iconPrefix: 'my-icon'
iconPrefix: 'my-icon',
});
await later();
@@ -139,7 +139,7 @@ test('toast duration 0', () => {
Toast.allowMultiple();
const toast = Toast({
message: 'toast',
duration: 0
duration: 0,
});
expect(toast.timer).toBeFalsy();
Toast.allowMultiple(false);
@@ -150,7 +150,7 @@ test('onClose callback', () => {
const onClose = jest.fn();
const toast = Toast({
message: 'toast',
onClose
onClose,
});
toast.clear();
@@ -161,7 +161,7 @@ test('onClose callback', () => {
test('closeOnClick option', async () => {
Toast.allowMultiple();
const toast = Toast({
message: 'toast'
message: 'toast',
});
await later();