File tree Expand file tree Collapse file tree 6 files changed +64
-6
lines changed
Expand file tree Collapse file tree 6 files changed +64
-6
lines changed Original file line number Diff line number Diff line change 1+ import { Component , useState } from "@odoo/owl" ;
2+
3+
4+ export class Card extends Component {
5+ static template = "awesome_owl.card" ;
6+
7+ static props = {
8+ title : { type : String } ,
9+ content : { type : String }
10+ }
11+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <templates xml : space =" preserve" >
3+ <t t-name =" awesome_owl.card" >
4+ <div class =" card d-inline-block m-2" style =" width: 18rem;" >
5+ <div class =" card-body" >
6+ <h5 class =" card-title" >
7+ <t t-out =" props.title" />
8+ </h5 >
9+ <p class =" card-text" >
10+ <t t-out =" props.content" />
11+ </p >
12+ </div >
13+ </div >
14+ </t >
15+ </templates >
Original file line number Diff line number Diff line change 1+ import { Component , useState } from "@odoo/owl" ;
2+
3+
4+ export class Counter extends Component {
5+ static template = "awesome_owl.counter" ;
6+
7+ setup ( ) {
8+ this . state = useState ( { counter : 0 } ) ;
9+ }
10+
11+ incrementCounter ( ) {
12+ this . state . counter ++ ;
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <templates xml : space =" preserve" >
3+ <t t-name =" awesome_owl.counter" >
4+ <p >Counter: <t t-esc =" state.counter" /></p >
5+ <button t-on-click =" incrementCounter" >Increment</button >
6+ </t >
7+ </templates >
Original file line number Diff line number Diff line change 1- import { Component } from "@odoo/owl" ;
1+ import { Component , useState } from "@odoo/owl" ;
2+ import { Counter } from "./counter/counter" ;
3+ import { Card } from "./card/card" ;
4+
25
36export class Playground extends Component {
47 static template = "awesome_owl.playground" ;
8+ static components = { Counter, Card } ;
9+ setup ( ) {
10+
11+ }
512}
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
22<templates xml : space =" preserve" >
3-
43 <t t-name =" awesome_owl.playground" >
5- <div class =" p-3" >
6- hello world
4+ Hello My Friend
5+ <div >
6+ <Counter />
7+ <Counter />
78 </div >
8- </t >
9-
9+ <div >
10+ <Card title =" 'Task 1'" content =" 'prepare things'" />
11+ <Card title =" 'Task 2'" content =" 'do stuff'" />
12+ </div >
13+ </t >
1014</templates >
You can’t perform that action at this time.
0 commit comments