private fun renderBooks(data: Array<String>) {
val books = document.create.div("books") {
table("table table-hover") {
thead {
tr {
th {
+"ID"
}
th {
+"Name"
}
}
}
tbody {
data.forEachIndexed { index, s ->
tr {
td {
+"$index"
}
td {
+s
}
}
}
}
}
}
document.getElementById("books")?.appendChild(books)
}
完整執行個體代碼參考:
https://github.com/Jason-Chen-2017/kotlin-js-gradle-demokotlinx.html參考文檔:
https://github.com/Kotlin/kotlinx.html