[DOC] readme: improve main example

This commit is contained in:
Géry Debongnie
2019-08-28 12:10:46 +02:00
parent 3628b49c37
commit 6ff4dd74bf
2 changed files with 12 additions and 4 deletions
+11 -3
View File
@@ -23,6 +23,10 @@ Here is a short example to illustrate interactive components:
<button t-name="Counter" t-on-click="increment">
Click Me! [<t t-esc="state.value"/>]
</button>
<div t-name="App">
<span>Hello Owl</span>
<Counter />
</div>
</templates>
```
@@ -35,9 +39,13 @@ class Counter extends owl.Component {
}
}
class App extends owl.Component {
components = { Counter };
}
const qweb = new owl.QWeb(TEMPLATES);
const counter = new Counter({ qweb });
counter.mount(document.body);
const app = new App({ qweb });
app.mount(document.body);
```
Note that we assume here that the xml templates are available in the `TEMPLATES`
@@ -99,4 +107,4 @@ Some npm scripts are available:
## License
OWL is [GPL licensed](./LICENSE).
OWL is [LGPL licensed](./LICENSE).
+1 -1
View File
@@ -103,7 +103,7 @@ const actions = {
try {
const loginInfo = await doSomeRPC("/login/", info);
state.loginState = loginInfo;
} catch {
} catch (e) {
state.loginState = "error";
}
}