Add m.prop (#2268)

Fixes #2095
This commit is contained in:
Isiah Meadows 2018-11-07 12:18:55 -05:00 committed by GitHub
parent 75626b30db
commit 6042b001f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 203 additions and 1 deletions

View file

@ -143,6 +143,26 @@ m.mount(document.body, Component)
---
#### m.prop(initial) - [docs](prop.md)
```javascript
var Component = {
oninit: function(vnode) {
vnode.state.current = m.prop("")
},
view: function(vnode) {
return m("input", {
oninput: function(ev) { vnode.state.current.set(ev.target.value) },
value: vnode.state.current.get(),
})
}
}
m.mount(document.body, Component)
```
---
#### m.trust(htmlString) - [docs](trust.md)
```javascript