This commit is contained in:
syuilo
2020-09-20 13:53:54 +09:00
parent b89bf97c9a
commit 404583a285
4 changed files with 14 additions and 5 deletions

View File

@@ -45,7 +45,13 @@ export function api(endpoint: string, data: Record<string, any> = {}, token?: st
return promise;
}
export function popup(component: Component, props: Record<string, any>, events = {}, option?) {
function isModule(x: any): x is typeof import('*.vue') {
return x.default != null;
}
export function popup(component: Component | typeof import('*.vue'), props: Record<string, any>, events = {}, option?) {
if (isModule(component)) component = component.default;
if (_DEV_) {
console.log('os:popup', component, props, events);
}
@@ -75,7 +81,9 @@ export function popup(component: Component, props: Record<string, any>, events =
});
}
export function modal(component: Component, props: Record<string, any>, events = {}, option?: { source?: any; position?: any; cancelableByBgClick?: boolean; }) {
export function modal(component: Component | typeof import('*.vue'), props: Record<string, any>, events = {}, option?: { source?: any; position?: any; cancelableByBgClick?: boolean; }) {
if (isModule(component)) component = component.default;
if (_DEV_) {
console.log('os:modal', component, props, events, option);
}