首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >离子3原生脱墨

离子3原生脱墨
EN

Stack Overflow用户
提问于 2017-11-20 10:23:03
回答 2查看 4.6K关注 0票数 7

成功地安装并安装了本机Ionic的深松模块。

即使在冷状态下,应用程序也能很好地加载,在那里它完全关闭。

然而,我的路线并没有把我带到正确的页面。它只显示应用程序的最后一个页面,如果它从冷状态启动应用程序,则显示主页面。

app.component.ts

代码语言:javascript
复制
...
import { Deeplinks } from '@ionic-native/deeplinks';
import { Detail1Page } from '../pages/layout/app1/detail1/detail1';
...
constructor(private deeplinks: Deeplinks.........
...
this.platform.ready().then(() => {
this.splashScreen.hide();
this.deeplinks.route({
  '/item/:itemId': Detail1Page
}).subscribe((match) => {
    console.log('Successfully matched route', JSON.stringify(match));
  }, (nomatch) => {
    console.error('Got a deeplink that didn\'t match', JSON.stringify(nomatch));
  });
}
...

控制台日志显示:

代码语言:javascript
复制
Successfully matched route {"$args":{"itemId":"9"},"$link":{"path":"/item/9","queryString":"","fragment":"","host":"my.app.com","url":"https://my.app.com/item/9","scheme":"https"}}

app.module.ts

代码语言:javascript
复制
...
import { Deeplinks } from '@ionic-native/deeplinks';
...
providers: [
    Deeplinks,
...

细节1.ts

代码语言:javascript
复制
...
this.itemId = this.navParams.get('itemId');
...

我们非常感谢你的帮助--一整天都在为这个工作:)

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-12-06 16:06:23

我昨天也遇到了同样的问题.

在我的例子中,我没有在我的app.module中注册我的页面。

代码语言:javascript
复制
@NgModule({
  declarations: [
    MyPage
  ],
  imports: [
    IonicPageModule.forChild(MyPage)
  ],
  entryComponents: [
    MyPage
  ]
})
export class MyPageModule {}

对我来说,我错过了IonicPageModule.forChild的参考。这里是文档页面,其中讨论了如何设置一个页面以便进行深度处理。https://ionicframework.com/docs/api/navigation/IonicPage/#usage

票数 2
EN

Stack Overflow用户

发布于 2019-11-28 05:33:10

我知道为时已晚,但对某人来说还是有帮助的。我在订阅后重定向用户,这样如果用户登录not,您就可以添加更多的逻辑,或者您可以相应地更改内容。

代码语言:javascript
复制
this.deeplinks.route({
  '/item/:itemId': {}
}).subscribe(match => { 
    console.log('Successfully matched route' + JSON.stringify(match));
    this.nav.push(Detail1Page, { issueId: match.$args.issueId});

  }
}, nomatch => {
  console.error('Got a deeplink that didn\'t match' + JSON.stringify(nomatch));
});
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47389769

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档