mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] update main example
This commit is contained in:
+5
-4
@@ -53,16 +53,17 @@
|
|||||||
<h2>Example</h2>
|
<h2>Example</h2>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<section class="column">
|
<section class="column">
|
||||||
<pre><code class="javascript">class Counter extends owl.Component {
|
<pre><code class="javascript">import { Component, QWeb, useState } from "owl";
|
||||||
state = { value: 0 };
|
|
||||||
|
class Counter extends Component {
|
||||||
|
state = useState({ value: 0 });
|
||||||
|
|
||||||
increment() {
|
increment() {
|
||||||
this.state.value++;
|
this.state.value++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const qweb = new owl.QWeb(TEMPLATES);
|
const counter = new Counter({ qweb: new QWeb() });
|
||||||
const counter = new Counter({ qweb });
|
|
||||||
counter.mount(document.body);</code></pre>
|
counter.mount(document.body);</code></pre>
|
||||||
</section>
|
</section>
|
||||||
<section class="column">
|
<section class="column">
|
||||||
|
|||||||
Reference in New Issue
Block a user