Skip to content

Instantly share code, notes, and snippets.

@TheOnlyTails
Created September 12, 2021 21:07
Show Gist options
  • Save TheOnlyTails/7ecbd032db9fbc8c93a12f7609c36e52 to your computer and use it in GitHub Desktop.
Save TheOnlyTails/7ecbd032db9fbc8c93a12f7609c36e52 to your computer and use it in GitHub Desktop.
<script lang="ts">
let count = 0;
</script>
<button on:click={() => count++}>{count}</button>
<style>
button {
color: red;
}
</style>
val counter by svelte {
var count by 0.state
template(/* optional parameter to specify HTML preprocessing with svelte-preprocess */) {
// write kotlinx.html code here
button() {
onClickFunction = { count++ }
+count
}
}
style(/* optional parameter to specify CSS preprocessing with svelte-preprocess */) {
button {
color = Color.red
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment