Arouter传参对象跳转
Posted 黄毛火烧雪下
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Arouter传参对象跳转相关的知识,希望对你有一定的参考价值。
//普通传参
var intent=Intent(context, VehicleRoomActivity::class.java)
var bundle=Bundle()
bundle.putParcelable(ARouters.Mine.ExtraKeys.KEY_EXTRA_VEHICLE_MODEL,data)
intent.putExtras(bundle)
startActivity(intent)
ARouters.Mine.VEHICLE_ROOM.navigation (activity=activity)
withParcelable(ARouters.Mine.ExtraKeys.KEY_EXTRA_VEHICLE_MODEL, data)
* 路由导航.
* @receiver String
* @param config ((Postcard) -> Unit)?
*/
fun String.navigation(
activity: Activity? = null,
requestCode: Int? = null,
callback: NavigationCallback? = null,
config: (Postcard.() -> Unit)? = null
)
runCatching
ARouter.getInstance()
.build(this).apply
config?.invoke(this)
.apply
if (requestCode != null && activity != null)
navigation(activity, requestCode, callback)
else
navigation(activity, callback)
.onFailure
debugInfo("页面跳转失败")
以上是关于Arouter传参对象跳转的主要内容,如果未能解决你的问题,请参考以下文章