mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Add some content
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
e4a1c99615
commit
4d79279f42
3
documentation/UI/index.md
Normal file
3
documentation/UI/index.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Index for UI code
|
||||
|
||||
1. [Rendering DOM elements](./render-dom-elements.md)
|
18
documentation/UI/render-dom-elements.md
Normal file
18
documentation/UI/render-dom-elements.md
Normal file
@ -0,0 +1,18 @@
|
||||
There are two options to render DOM elements:
|
||||
- Use `tag` from `ui/general/html.js`
|
||||
- Use `TemplateBuilder` object (t) from the render function in the view.
|
||||
|
||||
Although syntactically similar, they are not functionally equivalent.
|
||||
Primarily `tag` **does not support** bindings nor event handlers.
|
||||
|
||||
```js
|
||||
// The onClick here wont work!!
|
||||
tag.button({className:"awesome-btn", onClick: () => this.foo()});
|
||||
```
|
||||
For these functionalities always use the TemplateBuilder object that is passed as argument to the render method.
|
||||
```js
|
||||
render(t, vm){
|
||||
// The onClick works here.
|
||||
t.button({className:"awesome-btn", onClick: () => this.foo()});
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user