mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
@@ -663,7 +663,7 @@ function makeStore() {
|
|||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
owl.config.mode = "dev";
|
owl.config.mode = "dev";
|
||||||
const env = {store = makeStore()};
|
const env = {store: makeStore()};
|
||||||
mount(App, { target: document.body, env });
|
mount(App, { target: document.body, env });
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -939,7 +939,7 @@ For reference, here is the final code:
|
|||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
owl.config.mode = "dev";
|
owl.config.mode = "dev";
|
||||||
const env = {store = makeStore()};
|
const env = {store: makeStore()};
|
||||||
mount(App, { target: document.body, env });
|
mount(App, { target: document.body, env });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -771,7 +771,7 @@ template rendered with `props`. In Owl, this can be done by
|
|||||||
simply defining a template, that will access the `props` object:
|
simply defining a template, that will access the `props` object:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const Welcome = xml`<h1>Hello, {props.name}</h1>`;
|
const Welcome = xml`<h1>Hello, <t t-esc="props.name"/></h1>`;
|
||||||
|
|
||||||
class MyComponent extends Component {
|
class MyComponent extends Component {
|
||||||
static template = xml`
|
static template = xml`
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use cases, there is no need to directly instantiate an observer.
|
|||||||
For example, this code will display `update` in the console:
|
For example, this code will display `update` in the console:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const observer = new owl.Observer();
|
const observer = new owl.core.Observer();
|
||||||
observer.notifyCB = () => console.log("update");
|
observer.notifyCB = () => console.log("update");
|
||||||
const obj = observer.observe({ a: { b: 1 } });
|
const obj = observer.observe({ a: { b: 1 } });
|
||||||
|
|
||||||
@@ -39,14 +39,14 @@ is incremented every time the value is observed. Sometimes, it can be useful
|
|||||||
to obtain that number:
|
to obtain that number:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const observer = new owl.Observer();
|
const observer = new owl.core.Observer();
|
||||||
const obj = observer.observe({ a: { b: 1 } });
|
const obj = observer.observe({ a: { b: 1 } });
|
||||||
|
|
||||||
observer.deepRevNumber(obj.a); // 1
|
observer.revNumber(obj.a); // 1
|
||||||
obj.a.b = 2;
|
obj.a.b = 2;
|
||||||
|
|
||||||
observer.deepRevNumber(obj.a); // 2
|
observer.revNumber(obj.a); // 2
|
||||||
```
|
```
|
||||||
|
|
||||||
The `deepRevNumber` can also return 0, which indicates that the value is not
|
The `revNumber` can also return 0, which indicates that the value is not
|
||||||
observed.
|
observed.
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ Slots are defined by the caller, with the `t-set-slot` directive:
|
|||||||
```xml
|
```xml
|
||||||
<div t-name="SomeComponent">
|
<div t-name="SomeComponent">
|
||||||
<div>some component</div>
|
<div>some component</div>
|
||||||
<Dialog title="Some Dialog">
|
<Dialog title="'Some Dialog'">
|
||||||
<t t-set-slot="content">
|
<t t-set-slot="content">
|
||||||
<div>hey</div>
|
<div>hey</div>
|
||||||
</t>
|
</t>
|
||||||
|
|||||||
Reference in New Issue
Block a user