mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-04-20 17:21:03 +00:00
21 lines
484 B
JavaScript
21 lines
484 B
JavaScript
|
function newDialog(dialogComponent, data = {}) {
|
||
|
const outlet = document.createElement('div');
|
||
|
outlet.className = 'dialogoutlet';
|
||
|
document.getElementById('dialogoutlets').appendChild(outlet);
|
||
|
|
||
|
const instance = new dialogComponent({ target: outlet, props: data });
|
||
|
|
||
|
instance.$close = function() {
|
||
|
instance.$destroy();
|
||
|
outlet.remove();
|
||
|
};
|
||
|
|
||
|
instance.$on('close', instance.$close);
|
||
|
|
||
|
return instance;
|
||
|
}
|
||
|
|
||
|
const dialogs = { new: newDialog };
|
||
|
|
||
|
export default dialogs;
|