[bugfix] Dialog: cancel button display (#2685)

This commit is contained in:
neverland 2019-02-05 11:15:47 +08:00 committed by GitHub
parent 4374293c4e
commit b896113ad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 21 deletions

View File

@ -88,26 +88,28 @@ export default sfc({
const hasButtons = this.showCancelButton && this.showConfirmButton;
const ButtonGroup = (
<div class={['van-hairline--top', bem('footer', { buttons: hasButtons })]}>
<Button
vShow={this.showCancelButton}
size="large"
class={bem('cancel')}
loading={this.loading.cancel}
text={this.cancelButtonText || t('cancel')}
onClick={() => {
this.handleAction('cancel');
}}
/>
<Button
vShow={this.showConfirmButton}
size="large"
class={[bem('confirm'), { 'van-hairline--left': hasButtons }]}
loading={this.loading.confirm}
text={this.confirmButtonText || t('confirm')}
onClick={() => {
this.handleAction('confirm');
}}
/>
{this.showCancelButton && (
<Button
size="large"
class={bem('cancel')}
loading={this.loading.cancel}
text={this.cancelButtonText || t('cancel')}
onClick={() => {
this.handleAction('cancel');
}}
/>
)}
{this.showConfirmButton && (
<Button
size="large"
class={[bem('confirm'), { 'van-hairline--left': hasButtons }]}
loading={this.loading.confirm}
text={this.confirmButtonText || t('confirm')}
onClick={() => {
this.handleAction('confirm');
}}
/>
)}
</div>
);

View File

@ -7,7 +7,10 @@ transitionStub();
test('Dialog function call', async () => {
Dialog.close();
Dialog.alert('1');
Dialog.alert({
message: '1',
showCancelButton: true
});
await later();
@ -35,6 +38,7 @@ test('before close', () => {
const wrapper = mount(DialogVue, {
propsData: {
value: true,
showCancelButton: true,
beforeClose: (action, done) => done(false)
}
});