mirror of
https://github.com/esiur/iui.git
synced 2025-06-27 09:23:12 +00:00
scope
This commit is contained in:
24
docs/md/components/iui-element.md
Normal file
24
docs/md/components/iui-element.md
Normal file
@ -0,0 +1,24 @@
|
||||
# IUI Element
|
||||
|
||||
*IUIElement* is the base class for all IUI components, it extends the HTMLElement, adds more functionality and define itself as a customElement in the browser.
|
||||
|
||||
IuI Widgets tags start with `<i-...>` to differentiate them from the built in html tags.
|
||||
|
||||
# Initialization Process
|
||||
|
||||
When the document is loaded or new HTML is inserted in the document, IUI process of initialization start which consists of
|
||||
|
||||
1- IUI.create(rootElement)
|
||||
create is called on every IUI element in the tree, asking these elements to create themselves, in this phase an element can add more children to itself. (**IUIElement**)
|
||||
|
||||
1- IUI.bind(rootElement)
|
||||
IUI.bind ensures that all executable attributes starting with : are compiled and tested for data binding.
|
||||
Any property that is used by the `d` variable will be a candidate for binding, which means IUI will handle any modification on that property. (**IUIElement** and **HTMLElement**)
|
||||
|
||||
3- IUI.created(rootElement)
|
||||
Notify every IUI element that the create and bind process has ended. (**IUIElement**)
|
||||
|
||||
4- IUI.render(element)
|
||||
Render invokes the data binding functions and sets the element text nodes and attributes to the value returned by the binding functions. The process is recursive to all children in the element tree (**IUIElement** and **HTMLElement**)
|
||||
|
||||
The rootElement is the first `<i-app>` in the document when its loaded.
|
14
docs/md/components/repeat.md
Normal file
14
docs/md/components/repeat.md
Normal file
@ -0,0 +1,14 @@
|
||||
# I-Repeat
|
||||
|
||||
`<i-repeat>` performs a an iteration on an array and builds elements according to the given list
|
||||
|
||||
|
||||
<i-codepreview>
|
||||
<i-repeat :data="['Apple', 'Orange', 'Grape']">
|
||||
<div>${d}</div>
|
||||
</i-repeat>
|
||||
</i-codepreview>
|
||||
|
||||
if the iteration on a specific element is needed, *repeat* attribute must be added to the element.
|
||||
|
||||
*Note* each element in the iteration has an index property
|
13
docs/md/getting-started/scope.md
Normal file
13
docs/md/getting-started/scope.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Scope Variables
|
||||
|
||||
Scope variables are provided during the rendering process to the scripts and declarative rendering functions.
|
||||
|
||||
These variables propagate from an element to its children and could be altered or overwritten by any element in the tree so the children of that element receive a new value for these variables.
|
||||
|
||||
|
||||
<i-codepreview>
|
||||
<div :scope="{now: new Date()}">
|
||||
<div>Date: ${now.toDateString()}</div>
|
||||
<div>Time: ${now.toTimeString()}</div>
|
||||
</div>
|
||||
</i-codepreview>
|
Reference in New Issue
Block a user