Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyoung committed Jul 8, 2019
1 parent f4bce82 commit 2b159ec
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/docs/en-US/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ If the variable bound to `visible` is managed in Vuex store, the `.sync` can not
| show-close | whether to show a close button | boolean || true |
| before-close | callback before Dialog closes, and it will prevent Dialog from closing | function(done),done is used to close the Dialog |||
| center | whether to align the header and footer in center | boolean || false |
| destroy-on-close | Destroy elements in Dialog when closed | boolean || false |

### Slot

Expand Down
1 change: 1 addition & 0 deletions examples/docs/es/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ Si la variable ligada a `visible` se gestiona en el Vuex store, el `.sync` no pu
| show-close | si mostrar un botón de cerrar | boolean || true |
| before-close | una devolución de llamada antes de que se cierre el cuadro de diálogo, y evitar cerrar el cuadro de diálogo | función(done) `done`se usa para cerrar el diálog |||
| center | si alinear el encabezado y el pie de página en el centro | boolean || false |
| destroy-on-close | Destroy elements in Dialog when closed | boolean || false |

### Slots

Expand Down
1 change: 1 addition & 0 deletions examples/docs/fr-FR/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ Si la variable liée à `visible` est gérée dans Vuex, le modificateur `.sync`
| show-close | Si le bouton de fermeture doit apparaître. | boolean || true |
| before-close | Callback avant la fermeture du Dialog. | function(done),done est utilisé pour fermer le Dialog. |||
| center | Si le header et le footer doivent être centrés. | boolean || false |
| destroy-on-close | Destroy elements in Dialog when closed | boolean || false |

### Slot

Expand Down
1 change: 1 addition & 0 deletions examples/docs/zh-CN/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ Dialog 的内容是懒渲染的,即在第一次被打开之前,传入的默
| show-close | 是否显示关闭按钮 | boolean || true |
| before-close | 关闭前的回调,会暂停 Dialog 的关闭 | function(done),done 用于关闭 Dialog |||
| center | 是否对头部和底部采用居中布局 | boolean || false |
| destroy-on-close | 关闭时销毁 Dialog 中的元素 | boolean || false |

### Slot
| name | 说明 |
Expand Down
29 changes: 28 additions & 1 deletion test/unit/specs/dialog.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createVue, destroyVM } from '../util';
import { createVue, destroyVM, waitImmediate } from '../util';

describe('Dialog', () => {
let vm;
Expand Down Expand Up @@ -289,4 +289,31 @@ describe('Dialog', () => {
}, 500);
}, 10);
});

it('destroyOnClose', async() => {
vm = createVue({
template: `
<div>
<el-dialog :title="title" :visible.sync="visible" destroy-on-close>
<input />
</el-dialog>
</div>
`,

data() {
return {
title: 'dialog test',
visible: true
};
}
}, true);
const dialog = vm.$children[0];
await waitImmediate();
dialog.$el.querySelector('input').value = '123';
dialog.$el.click();
await waitImmediate();
vm.visible = true;
await waitImmediate();
expect(dialog.$el.querySelector('input').value).to.be.equal('');
});
});
3 changes: 3 additions & 0 deletions types/dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,8 @@ export declare class ElDialog extends ElementUIComponent {
/** Whether to align the header and footer in center */
center: boolean

/** Whether to destroy elements in Dialog when closed */
destroyOnClose: boolean

$slots: DialogSlots
}

0 comments on commit 2b159ec

Please sign in to comment.