chore: add trailingComma
This commit is contained in:
@@ -23,28 +23,28 @@ export default createComponent({
|
||||
showCancelButton: Boolean,
|
||||
transition: {
|
||||
type: String,
|
||||
default: 'van-dialog-bounce'
|
||||
default: 'van-dialog-bounce',
|
||||
},
|
||||
showConfirmButton: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
loading: {
|
||||
confirm: false,
|
||||
cancel: false
|
||||
}
|
||||
cancel: false,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -90,7 +90,7 @@ export default createComponent({
|
||||
|
||||
onClosed() {
|
||||
this.$emit('closed');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
render() {
|
||||
@@ -166,5 +166,5 @@ export default createComponent({
|
||||
</div>
|
||||
</transition>
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
+11
-11
@@ -16,7 +16,7 @@
|
||||
<demo-block :title="$t('componentCall')">
|
||||
<van-button type="primary" @click="show = true">{{ $t('componentCall') }}</van-button>
|
||||
<van-dialog v-model="show" :title="$t('title')" show-cancel-button :lazy-render="false">
|
||||
<img :src="image">
|
||||
<img :src="image" />
|
||||
</van-dialog>
|
||||
</demo-block>
|
||||
</demo-section>
|
||||
@@ -31,22 +31,22 @@ export default {
|
||||
confirm: '确认弹窗',
|
||||
asyncClose: '异步关闭',
|
||||
componentCall: '组件调用',
|
||||
content: '代码是写出来给人看的,附带能在机器上运行'
|
||||
content: '代码是写出来给人看的,附带能在机器上运行',
|
||||
},
|
||||
'en-US': {
|
||||
alert1: 'Alert',
|
||||
alert2: 'Alert without title',
|
||||
confirm: 'Confirm dialog',
|
||||
asyncClose: 'Async Close',
|
||||
componentCall: 'Component Call'
|
||||
}
|
||||
componentCall: 'Component Call',
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
currentRate: 0,
|
||||
image: 'https://img.yzcdn.cn/vant/apple-3.jpg'
|
||||
image: 'https://img.yzcdn.cn/vant/apple-3.jpg',
|
||||
};
|
||||
},
|
||||
|
||||
@@ -54,20 +54,20 @@ export default {
|
||||
onClickAlert() {
|
||||
this.$dialog.alert({
|
||||
title: this.$t('title'),
|
||||
message: this.$t('content')
|
||||
message: this.$t('content'),
|
||||
});
|
||||
},
|
||||
|
||||
onClickAlert2() {
|
||||
this.$dialog.alert({
|
||||
message: this.$t('content')
|
||||
message: this.$t('content'),
|
||||
});
|
||||
},
|
||||
|
||||
onClickConfirm() {
|
||||
this.$dialog.confirm({
|
||||
title: this.$t('title'),
|
||||
message: this.$t('content')
|
||||
message: this.$t('content'),
|
||||
});
|
||||
},
|
||||
|
||||
@@ -83,10 +83,10 @@ export default {
|
||||
this.$dialog.confirm({
|
||||
title: this.$t('title'),
|
||||
message: this.$t('content'),
|
||||
beforeClose
|
||||
beforeClose,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
+5
-5
@@ -17,8 +17,8 @@ function initInstance() {
|
||||
el: document.createElement('div'),
|
||||
// avoid missing animation when first rendered
|
||||
propsData: {
|
||||
lazyRender: false
|
||||
}
|
||||
lazyRender: false,
|
||||
},
|
||||
});
|
||||
|
||||
instance.$on('input', value => {
|
||||
@@ -39,7 +39,7 @@ function Dialog(options) {
|
||||
|
||||
Object.assign(instance, Dialog.currentOptions, options, {
|
||||
resolve,
|
||||
reject
|
||||
reject,
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -68,14 +68,14 @@ Dialog.defaultOptions = {
|
||||
closeOnClickOverlay: false,
|
||||
callback: action => {
|
||||
instance[action === 'confirm' ? 'resolve' : 'reject'](action);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Dialog.alert = Dialog;
|
||||
|
||||
Dialog.confirm = options => Dialog({
|
||||
showCancelButton: true,
|
||||
...options
|
||||
...options,
|
||||
});
|
||||
|
||||
Dialog.close = () => {
|
||||
|
||||
@@ -7,7 +7,7 @@ test('Dialog function call', async () => {
|
||||
Dialog.close();
|
||||
Dialog.alert({
|
||||
message: '1',
|
||||
showCancelButton: true
|
||||
showCancelButton: true,
|
||||
});
|
||||
|
||||
await later();
|
||||
@@ -38,8 +38,8 @@ test('before close', () => {
|
||||
value: true,
|
||||
showCancelButton: true,
|
||||
closeOnClickOverlay: true,
|
||||
beforeClose: (action, done) => done(false)
|
||||
}
|
||||
beforeClose: (action, done) => done(false),
|
||||
},
|
||||
});
|
||||
|
||||
const cancel = wrapper.find('.van-dialog__cancel');
|
||||
@@ -52,7 +52,7 @@ test('before close', () => {
|
||||
if (action === 'cancel') {
|
||||
done();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const overlay = document.querySelector('.van-overlay');
|
||||
@@ -81,8 +81,8 @@ test('button color', () => {
|
||||
value: true,
|
||||
showCancelButton: true,
|
||||
cancelButtonColor: 'white',
|
||||
confirmButtonColor: 'red'
|
||||
}
|
||||
confirmButtonColor: 'red',
|
||||
},
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
@@ -93,8 +93,8 @@ test('button text', () => {
|
||||
value: true,
|
||||
showCancelButton: true,
|
||||
cancelButtonText: 'Custom cancel',
|
||||
confirmButtonText: 'Custom confirm'
|
||||
}
|
||||
confirmButtonText: 'Custom confirm',
|
||||
},
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
@@ -106,11 +106,11 @@ test('dialog component', () => {
|
||||
test('default slot', () => {
|
||||
const wrapper = mount(DialogComponent, {
|
||||
propsData: {
|
||||
value: true
|
||||
value: true,
|
||||
},
|
||||
scopedSlots: {
|
||||
default: () => 'Custom Message'
|
||||
}
|
||||
default: () => 'Custom Message',
|
||||
},
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
@@ -118,11 +118,11 @@ test('default slot', () => {
|
||||
test('title slot', () => {
|
||||
const wrapper = mount(DialogComponent, {
|
||||
propsData: {
|
||||
value: true
|
||||
value: true,
|
||||
},
|
||||
scopedSlots: {
|
||||
title: () => 'Custom Title'
|
||||
}
|
||||
title: () => 'Custom Title',
|
||||
},
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
@@ -139,8 +139,8 @@ test('width prop', () => {
|
||||
const wrapper = mount(DialogComponent, {
|
||||
propsData: {
|
||||
value: true,
|
||||
width: 200
|
||||
}
|
||||
width: 200,
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.element.style.width).toEqual('200px');
|
||||
|
||||
Reference in New Issue
Block a user