5.17

查了一下 怎么路由跳转 但现在跳转页面的时候 需要传递数据 
找了几种方法 试了一下 都不行
```

@RequiresApi(Build.VERSION_CODES.O)
@Composable
fun AppNavHost(
rootNavController: NavHostController = rememberNavController(),
@SuppressLint("ModifierParameter") modifier: Modifier = Modifier
) {
NavHost(
navController = rootNavController,
startDestination = "login",
modifier = modifier
) {
composable("login") {
LoginScreen(rootNavHostController = rootNavController)
}
composable("plan") {
PlanScreen(rootNavHostController = rootNavController)
}
composable("record/{planId}") {backStackEntry ->
val planId = backStackEntry.arguments?.getString("planId")
RecordScreen(rootNavHostController = rootNavController,planId=planId!!.toInt())
}

}
}
```
posted @ 2024-05-17 23:42  258333  阅读(4)  评论(0编辑  收藏  举报