通过推式通知打开链接时,我试图获得离子深层链接来打开我的应用程序中的特定内容。
当我单击链接时,将打开应用程序的正确区域,但该组件未初始化。它只是挂在加载屏幕上。我将app.component.ts设置如下:
app.component.ts
this.deeplinks.route({
'/': HomeComponent,
'/club-news' : ClubNewsComponent,
'/match-news': MatchNewsComponent,
'/news': NewsComponent,
'/match': StatsComponent,
'/store/category/:id/product/:id': ProductItemDetailComponent
}).subscribe((match) => {
this.router.navigate([match.$link.queryString]);
console.log('Successfully matched route', match)
}, (nomatch)=> {
nomatch.$link
console.error('Got deeplink that did not match', nomatch)
})
我这样安装插件:
ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myApp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=domain.io
如果要测试,请执行以下操作:
https://domain.io/match-链接会将用户发送到匹配页面,但不会加载StatsComponent。它只是挂起并显示加载图标。因此基本上是 * ngIf =“!stats” 。
我正在努力寻找一种方法来进行适当的测试,因为远程设备调试不会显示控制台日志,并且使用 ionic serve 不会加载任何cordova插件。
以前有人看过吗?