kotlin - Jetpack Compose 带有导航 backstackentry 参数和深度链接参数
问题描述
如何添加通过正常导航传递的正常参数和来自的参数
而其他深层链接将具有正常模式
可与导航和深层链接参数组合
composable(
route = Route.Device.plus("/{Id}"),
arguments = listOf(
navArgument("Id") { type = NavType.StringType },
),
deepLinks = listOf(navDeepLink { uriPattern = Route.Device.plus("/{Id}") }),
content = { backStackEntry ->
val id = backStackEntry.arguments?.getString("Id")
DeviceScreen(
navController = navController,
id = id,
)
}
)
显现
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
其他可组合的普通导航和深层链接
composable(
route = Route.Home,
deepLinks = listOf(navDeepLink { uriPattern = Route.Home}),
content = { backStackEntry ->
HomeScreen(
navController = navController,
)
}
)
解决方案
推荐阅读
- javascript - 如何创建一个可以在一段代码中多次调用的等待函数
- angular - 不理解不可变对象
- javascript - 角度发送空参数。它不应该
- javascript - 为什么我可以多次声明一个 javascript var?
- amazon-web-services - DynamoDB 架构建议
- php - 如何在 laravel eloquent 中连接一对多关系?
- mysql - 如何在子查询中使用 WHERE IN 与字符串列中的值?
- php - Laravel - 为具有不同数量的产品验证服务器端的数量字段
- python - & 不支持的操作数类型:“str”和“时间戳”
- php - 带有默认集线器图像或一个自定义单个堆栈的 Docker LAMP