mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
16 lines
361 B
JavaScript
16 lines
361 B
JavaScript
|
|
import { mount, Component, useState, loadFile } from "@odoo/owl";
|
||
|
|
|
||
|
|
class Counter extends Component {
|
||
|
|
static template = "Counter";
|
||
|
|
setup() {
|
||
|
|
this.state = useState({ value: 0 });
|
||
|
|
}
|
||
|
|
|
||
|
|
increment() {
|
||
|
|
this.state.value++;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
const templates = await loadFile("./counter.xml");
|
||
|
|
|
||
|
|
mount(Counter, document.getElementById("app-container"), { templates });
|