https://kotlinlang.org logo
s

Samkeene

05/27/2020, 7:55 PM
Hopefully someone can explain this for me, I have a bootstrap progress bar:
Copy code
Div(classes = setOf("progress", "m-1", "position-relative")) {
    div(classes = setOf("progress-bar-no-animation", "progress-bar-striped", "bg-info", "barText")) {
        bind(playerStore) { player ->
            role = "progressbar"
            setAttribute("aria-valuenow", player.attackBar.toString())
            setAttribute("aria-valuemin", "0")
            setAttribute("aria-valuemax", player.attackBarMax.toString())
            width = CssSize((player.attackBar * 100) / player.attackBarMax, UNIT.perc)
        }
    }
    tag(TAG.LABEL, classes = setOf("justify-content-center", "h-inherit", "align-items-center", "d-flex", "position-absolute", "w-100")) {
        bind(playerStore) { player ->
            content = "Attack: ${player.attackBar.toInt()} / ${player.attackBarMax}"
        }
    }
}
Now whats interesting is that the inner div doesn't seem to need to be replaced by the virtual dom, but its attributes are changed. The label however does seem to be replaced each time: