2
0
mirror of https://github.com/esiur/iui.git synced 2025-06-27 17:33:12 +00:00
This commit is contained in:
2021-11-15 00:11:12 +03:00
parent 589c4f3227
commit e52b89fb4d
13 changed files with 213 additions and 41 deletions

View File

@ -1,2 +1,20 @@
# Referencing
To avoid duplication, IUI relies on referencing instead of element id.
Refs is a scope variable contains a collection of every element in the tree, unless overwritten by another component.
<i-codepreview>
<button @click="refs.modification.innerHTML = new Date()">Click me</button>
<div>Last modification : </div><div ref="modification"></div>
</i-codepreview>
When a duplicated referecing happens, the key in the refs collection will represent an array of the duplicated elements. *note: this always happends in I-Repeat components*
<i-codepreview>
<button @click="refs.name[0].innerHTML = 'Zak'; refs.name[1].innerHTML = 'Bilal'">
Click me
</button>
<div>First Name : </div><div ref="name"></div>
<div>Last Name : </div><div ref="name"></div>
</i-codepreview>