mirror of
https://github.com/bobwen-dev/react-templates
synced 2025-04-12 00:56:39 +02:00

Rationale: It is typical to want to alias multiple subtrees of a nested structure in a single rt-scope statement, like so: <div rt-scope="this.props.user as user; user.profile as profile; user.friends as friends"> This was not possible because of the function parameter based implementation of rt-scope. I tweaked it a bit to use var declaration instead, while preserving the parameter-based passing for all child scopes.
12 lines
426 B
Plaintext
12 lines
426 B
Plaintext
<div>
|
|
<div rt-repeat="foo in [1]">
|
|
<!-- can't seem to have an object literal here; will deal with this separately -->
|
|
<div rt-scope="[{first: 'Jack', last: 'Sparrow', skills: ['talking', 'fighting', 'commandeering']}][0] as pirate; pirate.first as first">
|
|
<h1>{first} {pirate.last}</h1>
|
|
<div rt-scope="pirate.skills as skills">
|
|
<span rt-repeat="skill in skills">{skill}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|