[bugfix] Toast: destroy instance in multiple mode (#1959)

This commit is contained in:
neverland 2018-10-21 20:20:35 +08:00 committed by GitHub
parent 2e8d7e0b4f
commit 9e2126bad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -49,6 +49,11 @@ function Toast(options = {}) {
...parseOptions(options), ...parseOptions(options),
clear() { clear() {
toast.value = false; toast.value = false;
if (!singleton && !isServer) {
document.body.removeChild(toast.$el);
toast.$destroy();
}
} }
}; };

View File

@ -5,7 +5,8 @@ transitionStub();
test('create a forbidClick toast', async() => { test('create a forbidClick toast', async() => {
const toast = Toast({ const toast = Toast({
forbidClick: true forbidClick: true,
type: 'success'
}); });
expect(toast.$el.outerHTML).toMatchSnapshot(); expect(toast.$el.outerHTML).toMatchSnapshot();