FormLink使用uri进行deeplink跳转,配置了uris但跳转失败
harmonyos
我尝试使用FormLink的uri参数实现deeplink跳转,但点击后没有任何反应,也没有错误日志。
卡片代码:
@Entry
@Component
struct ProductCard {
@State productId: string = '12345'
build() {
Column() {
Text("产品推荐")
.fontSize(18)
.margin(10)
// 使用uri进行deeplink跳转
FormLink({
action: "router",
uri: 'myscheme://products/detail?id=' + this.productId,
params: {
'source': 'product_card',
'timestamp': Date.now()
}
}) {
Button("查看详情")
.width(120)
}.margin(10)
// 同时测试abilityName方式(这个可以正常工作)
FormLink({
action: "router",
abilityName: "ProductDetailAbility",
bundleName: "com.example.shop",
params: {
'productId': this.productId
}
}) {
Button("Ability方式跳转")
.width(120)
}
}
}
}
module.json5配置:
{
"module": {
"abilities": [
{
"name": "ProductDetailAbility",
"srcEntry": "./ets/productability/ProductDetailAbility.ts",
"description": "产品详情页面",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
],
"uris": [
{
"scheme": "myscheme",
"host": "products",
"path": "detail"
}
]
}
]
}
]
}
}
有几个问题:
-
uri方式的FormLink点击后无反应
-
abilityName方式可以正常工作
-
没有错误日志输出
-
deeplink配置看起来正确
如何正确配置和使用uri方式的FormLink跳转?