mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
t-widget directive
This commit is contained in:
@@ -5,6 +5,7 @@ const template = `
|
||||
<div t-debug="1">
|
||||
<span>Root Widget</span>
|
||||
<button t-on-click="resetCounter">Reset</button>
|
||||
<button t-on-click="resetCounterAsync">Reset in 3s</button>
|
||||
<button t-on-click="toggle">Toggle Counter</button>
|
||||
<input/>
|
||||
<t t-if="state.validcounter">
|
||||
@@ -23,6 +24,12 @@ export default class RootWidget extends Widget {
|
||||
this.refs.counter.updateState({counter: 3})
|
||||
}
|
||||
|
||||
resetCounterAsync(ev: MouseEvent) {
|
||||
setTimeout(() => {
|
||||
this.refs.counter.updateState({counter: 3})
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
toggle() {
|
||||
this.updateState({validcounter: !this.state.validcounter});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user