①不同 Slice 间跳转,同一个 Ability 中,优点是方便,高效,缺点是业务逻辑复杂度受限。
button.setClickedListener(
listener -> present(new SecondAbilitySlice(), new Intent())
);
②使用 Intent 借助于 ElementName,最常用的页面跳转方式,方便传递参数以及实现相对复杂的业务逻辑交互。
ElementName elementName = new ElementName(……);
intent.setElement(elementName);
intent.setParam(……);
startAbility(intent);
③借助于 Operation,可实现跨应用页面跳转。
Intent intent = new Intent();
Operation operation = new Intent.OperationBuilder()
.withDeviceId("")
.withBundleName("com.demoapp")
.withAbilityName("com.demoapp.FooAbility")
.build();
intent.setOperation(operation);
startAbility(intent);
④Rout 路由(JS),调用 router.push() 接口将 uri 指定的页面添加到路由栈中,即跳转到 uri 指定的页面。在调用 router 方法之前