File tree Expand file tree Collapse file tree 4 files changed +34
-6
lines changed Expand file tree Collapse file tree 4 files changed +34
-6
lines changed Original file line number Diff line number Diff line change
1
+ /** @odoo -module **/
2
+
3
+ import { Component , useState } from "@odoo/owl" ;
4
+
5
+ export class Counter extends Component {
6
+ static template = "awesome_owl.counter" ;
7
+
8
+ setup ( ) {
9
+ this . state = useState ( { value : 0 } ) ;
10
+ }
11
+
12
+ increment ( ) {
13
+ this . state . value ++ ;
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <templates xml : space =" preserve" >
3
+
4
+ <t t-name =" awesome_owl.counter" >
5
+ <div >Hello World
6
+ <p >Counter: <t t-esc =" state.value" />
7
+ </p >
8
+ <button class =" btn btn-primary" t-on-click =" increment" >Increment</button >
9
+ </div >
10
+ </t >
11
+
12
+ </templates >
Original file line number Diff line number Diff line change 1
1
/** @odoo -module **/
2
2
3
- import { Component } from "@odoo/owl" ;
3
+ import { Component , useState } from "@odoo/owl" ;
4
+ import { Counter } from "./counter" ;
4
5
5
6
export class Playground extends Component {
6
7
static template = "awesome_owl.playground" ;
7
- }
8
+ static components = { Counter } ;
9
+ }
Original file line number Diff line number Diff line change 2
2
<templates xml : space =" preserve" >
3
3
4
4
<t t-name =" awesome_owl.playground" >
5
- <div class =" p-3" >
6
- hello world
7
- </div >
5
+ <Counter ></Counter >
6
+ <Counter ></Counter >
8
7
</t >
9
8
10
- </templates >
9
+ </templates >
You can’t perform that action at this time.
0 commit comments