Added internal comments to popup()
This commit is contained in:
parent
1613dafc39
commit
a516383c66
|
@ -204,13 +204,18 @@ export function popup<T extends Component>(
|
|||
): { dispose: () => void } {
|
||||
markRaw(component);
|
||||
|
||||
// Generate a unique ID for this popup.
|
||||
const id = ++popupIdCount;
|
||||
|
||||
// On disposal, remove this popup from the list of open popups.
|
||||
const dispose = () => {
|
||||
// このsetTimeoutが無いと挙動がおかしくなる(autocompleteが閉じなくなる)。Vueのバグ?
|
||||
window.setTimeout(() => {
|
||||
popups.value = popups.value.filter(p => p.id !== id);
|
||||
}, 0);
|
||||
};
|
||||
|
||||
// Bundle the component, props, and events into a state object.
|
||||
const state = {
|
||||
component,
|
||||
props,
|
||||
|
@ -218,8 +223,10 @@ export function popup<T extends Component>(
|
|||
id,
|
||||
};
|
||||
|
||||
// Add the popup to the list of open popups.
|
||||
popups.value.push(state);
|
||||
|
||||
// Return a function that can be called to close the popup.
|
||||
return {
|
||||
dispose,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue