mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
fix demo code
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ export default class Counter extends Widget {
|
|||||||
counter: 0
|
counter: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(parent: Widget, props: {initialState?: number}) {
|
constructor(parent: Widget | null, props: {initialState?: number}) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.state.counter = props.initialState || 0;
|
this.state.counter = props.initialState || 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-16
@@ -1,22 +1,23 @@
|
|||||||
///<amd-module name="main" />
|
///<amd-module name="main" />
|
||||||
|
|
||||||
import QWeb from "../../src/core/qweb_vdom";
|
// import QWeb from "../../src/core/qweb_vdom";
|
||||||
import {init} from "../../src/libs/snabbdom/src/snabbdom"
|
// import {init} from "../../src/libs/snabbdom/src/snabbdom"
|
||||||
import h from "../../src/libs/snabbdom/src/h"
|
// import h from "../../src/libs/snabbdom/src/h"
|
||||||
import sdProps from "../../src/libs/snabbdom/src/modules/props"
|
// import sdProps from "../../src/libs/snabbdom/src/modules/props"
|
||||||
import sdListeners from "../../src/libs/snabbdom/src/modules/eventlisteners"
|
// import sdListeners from "../../src/libs/snabbdom/src/modules/eventlisteners"
|
||||||
|
|
||||||
const patch = init([sdProps, sdListeners]);
|
// const patch = init([sdProps, sdListeners]);
|
||||||
|
|
||||||
(<any>window).h = h;
|
// (<any>window).h = h;
|
||||||
(<any>window).patch = patch;
|
// (<any>window).patch = patch;
|
||||||
(<any>window).QWeb = QWeb;
|
// (<any>window).QWeb = QWeb;
|
||||||
|
import Counter from "./Counter";
|
||||||
// import RootWidget from "./RootWidget";
|
// import RootWidget from "./RootWidget";
|
||||||
// import env from "./env";
|
import env from "./env";
|
||||||
|
|
||||||
// document.addEventListener("DOMContentLoaded", async function() {
|
document.addEventListener("DOMContentLoaded", async function() {
|
||||||
// const rootWidget = new RootWidget(null);
|
const rootWidget = new Counter(null, {});
|
||||||
// rootWidget.setEnvironment(env);
|
rootWidget.setEnvironment(env);
|
||||||
// const mainDiv = document.getElementById("app")!;
|
const mainDiv = document.getElementById("app")!;
|
||||||
// await rootWidget.mount(mainDiv);
|
await rootWidget.mount(mainDiv);
|
||||||
// });
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user