Skip to content

Commit bbe9dc1

Browse files
committed
Merge branch 'main' of https://github.com/dy/sprae
2 parents f5fa70b + 53a0086 commit bbe9dc1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

readme.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ Set style value.
105105

106106
```html
107107
<!-- extends style -->
108-
<div style="foo: bar" :style="'baz-baz: qux'">
108+
<div style="foo: bar" :style="'bar-baz: qux'">
109109

110110
<!-- object -->
111-
<div :style="{bazBaz: 'qux'}"></div>
111+
<div :style="{barBaz: 'qux'}"></div>
112112

113113
<!-- CSS variable -->
114-
<div :style="{'--baz-baz': qux}"></div>
114+
<div :style="{'--bar-baz': qux}"></div>
115115
```
116116

117117
#### `:value="value"`
@@ -163,8 +163,8 @@ Expose element with `name`.
163163
<textarea :ref="text" placeholder="Enter text..."></textarea>
164164

165165
<!-- iterable items -->
166-
<li :each="item in items" :ref="item">
167-
<input :onfocus..onblur="e => (item.classList.add('editing'), e => item.classList.remove('editing'))"/>
166+
<li :each="item in items" :ref="li">
167+
<input :onfocus..onblur="e => (li.classList.add('editing'), e => li.classList.remove('editing'))"/>
168168
</li>
169169
```
170170

@@ -176,7 +176,7 @@ Run effect, not changing any attribute.
176176
<div :fx="a.value ? foo() : bar()" />
177177

178178
<!-- cleanup function -->
179-
<div :fx="id = setInterval(tick, interval), () => clearInterval(tick)" />
179+
<div :fx="id = setInterval(tick, 1000), () => clearInterval(id)" />
180180
```
181181

182182
#### `:on<event>="handler"`, `:on<in>..on<out>="handler"`
@@ -375,6 +375,8 @@ sprae.use({ compile })
375375
* State getters/setters work as computed effects, eg. `sprae(el, { x:1, get x2(){ return this.x * 2} })`.
376376
* `this` keyword is not used, to get access to current element use `<input :ref="el" :text="el.value"/>`.
377377
* Async/await is not supported in attributes, it's a strong indicator you need to put these methods into state.
378+
* `:each` doesn't need `key` since it uses direct mapping, see [#44](https://github.com/dy/sprae/issues/44).
379+
* Event attributes always expect a function value `:onevt="event => handle()"`, see [#46](https://github.com/dy/sprae/issues/46).
378380

379381
## Justification
380382

0 commit comments

Comments
 (0)