Add include on form element
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package nl.astraeus.komp
|
||||
|
||||
import kotlinx.html.DIV
|
||||
import kotlinx.html.FORM
|
||||
import kotlinx.html.TagConsumer
|
||||
import kotlinx.html.dom.create
|
||||
import org.w3c.dom.HTMLElement
|
||||
@@ -13,6 +14,13 @@ fun DIV.include(component: Komponent) {
|
||||
Komponent.define(result, component)
|
||||
}
|
||||
|
||||
fun FORM.include(component: Komponent) {
|
||||
val result = component.render(this.consumer as TagConsumer<HTMLElement>)
|
||||
|
||||
component.element = result
|
||||
Komponent.define(result, component)
|
||||
}
|
||||
|
||||
abstract class Komponent {
|
||||
var element: HTMLElement? = null
|
||||
var rendered = false
|
||||
|
||||
Reference in New Issue
Block a user