NavHost(
navController = navController,
startDestination = MainDestinations.HOME_PAGE_ROUTE,
){
composable(MainDestinations.HOME_PAGE_ROUTE) {
HomeContent()
}
composable(MainDestinations.LOGIN_ROUTE) {
SignInScreen()
}
composable(MainDestinations.ABOUT_ME_ROUTE){
AboutMeScreen()
Log.i("cccccccccc","AboutMeScreen====$")
}
composable("${MainDestinations.ARTICLE_ROUTE}/{${MainDestinations.ARTICLE_ROUTE_URL}}"
,arguments = listOf(navArgument(MainDestinations.ARTICLE_ROUTE_URL){
type = NavType.StringType
})){ backStackEntry->
val arguments = requireNotNull(backStackEntry.arguments)
val parcelable = arguments.getString(ARTICLE_ROUTE_URL)
Log.i("cccccccccc","parcelable====$parcelable")
val fromJson = Gson().fromJson(parcelable, ArticleBean::class.java)
// ArticlePage(
// article = fromJson,
// onBack = actions.upPress
// )
Text("231231231")
}
}
image.png
主要就是这两个大括号的写法 不能漏
网友评论