20 lines
409 B
JavaScript
20 lines
409 B
JavaScript
|
const m = require('mithril')
|
||
|
|
||
|
const Input = {
|
||
|
oninit: function(vnode) {
|
||
|
},
|
||
|
|
||
|
view: function(vnode) {
|
||
|
return [
|
||
|
m('label', vnode.attrs.label),
|
||
|
m('input', {
|
||
|
type: vnode.attrs.type || 'text',
|
||
|
value: vnode.attrs.form[vnode.attrs.formKey],
|
||
|
oninput: (e) => { vnode.attrs.form[vnode.attrs.formKey] = e.currentTarget.value },
|
||
|
}),
|
||
|
]
|
||
|
},
|
||
|
}
|
||
|
|
||
|
module.exports = Input
|