mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Dialog: cancel button display (#2685)
This commit is contained in:
parent
4374293c4e
commit
b896113ad6
@ -88,26 +88,28 @@ export default sfc({
|
|||||||
const hasButtons = this.showCancelButton && this.showConfirmButton;
|
const hasButtons = this.showCancelButton && this.showConfirmButton;
|
||||||
const ButtonGroup = (
|
const ButtonGroup = (
|
||||||
<div class={['van-hairline--top', bem('footer', { buttons: hasButtons })]}>
|
<div class={['van-hairline--top', bem('footer', { buttons: hasButtons })]}>
|
||||||
<Button
|
{this.showCancelButton && (
|
||||||
vShow={this.showCancelButton}
|
<Button
|
||||||
size="large"
|
size="large"
|
||||||
class={bem('cancel')}
|
class={bem('cancel')}
|
||||||
loading={this.loading.cancel}
|
loading={this.loading.cancel}
|
||||||
text={this.cancelButtonText || t('cancel')}
|
text={this.cancelButtonText || t('cancel')}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.handleAction('cancel');
|
this.handleAction('cancel');
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
)}
|
||||||
vShow={this.showConfirmButton}
|
{this.showConfirmButton && (
|
||||||
size="large"
|
<Button
|
||||||
class={[bem('confirm'), { 'van-hairline--left': hasButtons }]}
|
size="large"
|
||||||
loading={this.loading.confirm}
|
class={[bem('confirm'), { 'van-hairline--left': hasButtons }]}
|
||||||
text={this.confirmButtonText || t('confirm')}
|
loading={this.loading.confirm}
|
||||||
onClick={() => {
|
text={this.confirmButtonText || t('confirm')}
|
||||||
this.handleAction('confirm');
|
onClick={() => {
|
||||||
}}
|
this.handleAction('confirm');
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -7,7 +7,10 @@ transitionStub();
|
|||||||
|
|
||||||
test('Dialog function call', async () => {
|
test('Dialog function call', async () => {
|
||||||
Dialog.close();
|
Dialog.close();
|
||||||
Dialog.alert('1');
|
Dialog.alert({
|
||||||
|
message: '1',
|
||||||
|
showCancelButton: true
|
||||||
|
});
|
||||||
|
|
||||||
await later();
|
await later();
|
||||||
|
|
||||||
@ -35,6 +38,7 @@ test('before close', () => {
|
|||||||
const wrapper = mount(DialogVue, {
|
const wrapper = mount(DialogVue, {
|
||||||
propsData: {
|
propsData: {
|
||||||
value: true,
|
value: true,
|
||||||
|
showCancelButton: true,
|
||||||
beforeClose: (action, done) => done(false)
|
beforeClose: (action, done) => done(false)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user