【问题描述】
js或者ETS怎么跳转到应用商店
【问题答案】
参考链接
【Harmony OS】【ARK UI】ets使用startAbility或startAbilityForResult方式调起Ability
代码如下
import featureAbility from '@ohos.ability.featureAbility'
import wantConstant from '@ohos.ability.wantConstant'
@Entry
@Component
struct Index {
@State message: string = '跳转到QQ详情界面'
public onclick(){
var str = {
"want": {
"deviceId": "",
"bundleName": "",
"abilityName": "",
"uri":"market://details?id=com.tencent.mobileqq",
"options": {},
"flags":wantConstant.Flags.FLAG_ABILITY_NEW_MISSION,
"action": "android.intent.action.VIEW",
"parameters": {},
},
"abilityStartSetting": {}
};
featureAbility.startAbility(str)
.then((data) => {
console.info('Operation successful. Data: ' + JSON.stringify(data))
}).catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(this.onclick.bind(this))
}
.width('100%')
}
.height('100%')
}
}
【运行效果】
欲了解更多更全技术文章,欢迎访问https://developer.huawei.com/consumer/cn/forum/?ha_source=zzh
标签:error,wantConstant,featureAbility,FAQ,UI,应用,跳转 From: https://www.cnblogs.com/developer-huawei/p/16641710.html