如何写精华回答,获更多曝光?
发布
前置条件
系统:OpenHarmony 3.1 release
SDK版本:API8
问题:通过startAbility启动页面后,如何在新页面中获取want.parameters中的参数,如:mykey0、mykey1...
import featureAbility from '@ohos.ability.featureAbility';
import wantConstant from '@ohos.ability.wantConstant'
featureAbility.startAbility(
{
want:
{
action: "action.system.home",
entities: ["entity.system.home"],
type: "MIMETYPE",
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
bundleName: "com.example.myapplication",
/* FA模型中abilityName由package + Ability name组成 */
abilityName: "com.example.entry.secondAbility",
uri:"",
parameters:
{
mykey0: 1111,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "xxxxxxxxxxxxxxxxxxxxxx",
mykey4: [1, 15],
mykey5: [false, true, false],
mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"],
mykey7: true,
},
},
},
).then((data) => {
console.info("==========================>startAbilityForResult=======================>");
});
。