Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Compose Playground
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Briar Staging
Compose Playground
Commits
c3403681
Commit
c3403681
authored
4 years ago
by
Oleksandr Karpovich
Browse files
Options
Downloads
Patches
Plain Diff
Update `web-getting-started` example and tutorial
parent
f54a4b96
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/web-getting-started/src/jsMain/kotlin/Main.kt
+6
-5
6 additions, 5 deletions
examples/web-getting-started/src/jsMain/kotlin/Main.kt
tutorials/Web/Getting_Started/README.md
+7
-0
7 additions, 0 deletions
tutorials/Web/Getting_Started/README.md
with
13 additions
and
5 deletions
examples/web-getting-started/src/jsMain/kotlin/Main.kt
+
6
−
5
View file @
c3403681
import
androidx.compose.runtime.mutableStateOf
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.padding
import
androidx.compose.web.css.px
import
androidx.compose.web.css.px
import
androidx.compose.web.elements.Button
import
androidx.compose.web.elements.Button
...
@@ -8,23 +10,22 @@ import androidx.compose.web.elements.Text
...
@@ -8,23 +10,22 @@ import androidx.compose.web.elements.Text
import
androidx.compose.web.renderComposable
import
androidx.compose.web.renderComposable
fun
main
()
{
fun
main
()
{
va
l
count
=
mutableStateOf
(
0
)
va
r
count
:
Int
by
mutableStateOf
(
0
)
renderComposable
(
rootElementId
=
"root"
)
{
renderComposable
(
rootElementId
=
"root"
)
{
Div
(
style
=
{
padding
(
25
.
px
)
})
{
Div
(
style
=
{
padding
(
25
.
px
)
})
{
Button
(
attrs
=
{
Button
(
attrs
=
{
onClick
{
count
.
value
=
count
.
value
-
1
}
onClick
{
count
-
=
1
}
})
{
})
{
Text
(
"-"
)
Text
(
"-"
)
}
}
Span
(
style
=
{
padding
(
15
.
px
)
})
{
Span
(
style
=
{
padding
(
15
.
px
)
})
{
Text
(
"$
{
count
.value}
"
)
Text
(
"$count"
)
}
}
Button
(
attrs
=
{
Button
(
attrs
=
{
onClick
{
count
.
value
=
count
.
value
+
1
}
onClick
{
count
+
=
1
}
})
{
})
{
Text
(
"+"
)
Text
(
"+"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
tutorials/Web/Getting_Started/README.md
+
7
−
0
View file @
c3403681
...
@@ -115,6 +115,13 @@ fun main() {
...
@@ -115,6 +115,13 @@ fun main() {
}
}
}
}
```
```
In case you see an error:
`Type 'MutableState<TypeVariable(T)>' has no method 'getValue(Nothing?, KProperty<*>)'...`
or
`Type 'MutableState<TypeVariable(T)>' has no method 'setValue(Nothing?, KProperty<*>, Int)'...`
, please add the imports:
```
kotlin
import
androidx.compose.runtime.getValue
import
androidx.compose.runtime.setValue
```
## Running the project
## Running the project
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment