Add model and add event listeners

This commit is contained in:
Misode
2020-05-25 03:37:39 +02:00
parent 92161c39f1
commit 1bef36a713
8 changed files with 128 additions and 33 deletions

View File

@@ -1,11 +1,17 @@
import { AbstractNode, NodeMods } from './AbstractNode'
import { Path } from '../model/Path'
import { DataModel } from '../model/DataModel'
export class StringNode extends AbstractNode<string> {
constructor(mods?: NodeMods<string>) {
super(mods)
}
render(field: string, value: string) {
return `<span>${field}</span> <span>${value || ''}</span>`
updateModel(el: Element, path: Path, model: DataModel) {
}
render(path: Path, value: string, model: DataModel) {
return this.wrap(path, model,
`<span>${path.last()}</span> <input value="${value || ''}"></input>`)
}
}