mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] app: mount app in "first-child" position
We reintroduce the possibility to mount the app in first position in a target. The option "self" has been dropped since it is now possible for a component to have several top level nodes.
This commit is contained in:
committed by
Géry Debongnie
parent
06d207f60e
commit
7d7568d254
+3
-2
@@ -1,5 +1,6 @@
|
||||
import { Component } from "./component/component";
|
||||
import { ComponentNode } from "./component/component_node";
|
||||
import { MountOptions } from "./component/fibers";
|
||||
import { Scheduler } from "./component/scheduler";
|
||||
import { TemplateSet } from "./qweb/template_helpers";
|
||||
|
||||
@@ -47,7 +48,7 @@ export class App<T extends typeof Component = any> extends TemplateSet {
|
||||
}
|
||||
}
|
||||
|
||||
mount(target: HTMLElement): Promise<InstanceType<T>> {
|
||||
mount(target: HTMLElement, options?: MountOptions): Promise<InstanceType<T>> {
|
||||
if (!(target instanceof HTMLElement)) {
|
||||
throw new Error("Cannot mount component: the target is not a valid DOM element");
|
||||
}
|
||||
@@ -56,7 +57,7 @@ export class App<T extends typeof Component = any> extends TemplateSet {
|
||||
}
|
||||
const node = new ComponentNode(this.Root, this.props, this);
|
||||
this.root = node;
|
||||
return node.mountComponent(target);
|
||||
return node.mountComponent(target, options);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
Reference in New Issue
Block a user