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 { inBrowser } from '../utils';
import { mountComponent, usePopupState } from '../utils/mount-component';
import VanDialog from './Dialog';
@@ -35,17 +34,13 @@ function Dialog(options) {
initInstance();
}
instance.setState({
instance.open({
...Dialog.currentOptions,
...options,
callback: (action) => {
(action === 'confirm' ? resolve : reject)(action);
},
});
nextTick(() => {
instance.toggle(true);
});
});
}