|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
import androidx.compose.runtime.mutableStateOf |
|
|
|
|
import androidx.compose.runtime.getValue |
|
|
|
|
import androidx.compose.runtime.setValue |
|
|
|
|
import androidx.compose.web.css.padding |
|
|
|
|
import androidx.compose.web.css.px |
|
|
|
|
import androidx.compose.web.elements.Button |
|
|
|
@ -8,23 +10,22 @@ import androidx.compose.web.elements.Text
|
|
|
|
|
import androidx.compose.web.renderComposable |
|
|
|
|
|
|
|
|
|
fun main() { |
|
|
|
|
val count = mutableStateOf(0) |
|
|
|
|
var count: Int by mutableStateOf(0) |
|
|
|
|
|
|
|
|
|
renderComposable(rootElementId = "root") { |
|
|
|
|
Div(style = { padding(25.px) }) { |
|
|
|
|
Button(attrs = { |
|
|
|
|
onClick { count.value = count.value - 1 } |
|
|
|
|
onClick { count -= 1 } |
|
|
|
|
}) { |
|
|
|
|
Text("-") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Span(style = { padding(15.px) }) { |
|
|
|
|
Text("${count.value}") |
|
|
|
|
Text("$count") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button(attrs = { |
|
|
|
|
onClick { count.value = count.value + 1 } |
|
|
|
|
onClick { count += 1 } |
|
|
|
|
}) { |
|
|
|
|
Text("+") |
|
|
|
|
} |
|
|
|
|