Closed over-space closed 1 month ago
plugins { id("java") id("org.jetbrains.kotlin.jvm") version "1.9.21" id("org.jetbrains.intellij") version "1.16.1" id("org.jetbrains.compose") version "1.6.0" } group = "com.learning.boot" version = "1.0-SNAPSHOT" repositories { google() mavenCentral() maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } maven { url = uri("https://jogamp.org/deployment/maven")} } dependencies { implementation(compose.desktop.currentOs) api("io.github.kevinnzou:compose-webview-multiplatform:1.9.0") }
@Preview @Composable fun MinimalExampleContent() { Column { val state = rememberWebViewState("https://github.com/KevinnZou/compose-webview-multiplatform") Text(text = "${state.pageTitle}") val loadingState = state.loadingState if (loadingState is LoadingState.Loading) { LinearProgressIndicator( progress = loadingState.progress, modifier = Modifier.fillMaxWidth() ) } WebView( state ) } }
@over-space To run this library on the Desktop target, it needs to download the kcef-bundle first and then refresh the page. For more details, you can refer to this sample.
kcef-bundle
build.gradle.kts配置
代码
预览结果