【关键字】
跳转详情页面
【问题描述】
应用如何跳转到华为应用市场应用详情页?
【解决方案】
应用跳转到详情页面Demo如下:
import { common, Want } from '@kit.AbilityKit';
@Entry
@Component
struct DistributeDemo {
@State appId: string = '应用id';
build() {
Row() {
Column() {
TextInput({ text: this.appId, placeholder: '请输入应用的appId' })
.width('90%')
.onChange((value: string) => {
this.appId = value
})
Button('点击跳转到鸿蒙版应用市场详情页面')
.margin({ top: 50 })
.onClick(() => {
const want: Want = {
uri: `store://appgallery.huawei.com/app/detail?id=${this.appId}`
};
const context = getContext(this) as common.UIAbilityContext;
context.startAbility(want).then(() => {
//拉起成功
}).catch(() => {
// 拉起失败
});
})
}
.width('100%')
}
.height('100%')
}
}