refactor: update usePopupState

This commit is contained in:
chenjiahan
2020-09-01 09:47:59 +08:00
parent c4921da290
commit 6e6cfe5c65
6 changed files with 37 additions and 51 deletions
+1 -6
View File
@@ -1,4 +1,3 @@
import { nextTick } from 'vue';
import { isObject, inBrowser } from '../utils';
import { mountComponent, usePopupState } from '../utils/mount-component';
import VanNotify from './Notify';
@@ -40,17 +39,13 @@ function Notify(options) {
...parseOptions(options),
};
instance.setState(options);
instance.open(options);
clearTimeout(timer);
if (options.duration && options.duration > 0) {
timer = setTimeout(Notify.clear, options.duration);
}
nextTick(() => {
instance.toggle(true);
});
return instance;
}