分段导航已更改URI之后,Ionic V3 Deeplinks插件启动

时间:2019-03-05 10:52:00

标签: ionic-framework ionic3 deep-linking

我有一个使用Ionic v3的应用程序,并且我正在尝试介绍深层链接机制。

问题是,如果我尝试使用包含任何页面细分的URL,则在启用深度链接机制之前,URL会更改为该细分。 这就是我的意思:

我有一个名为“用户”的页面,该页面是用户和用户详细信息的列表:

echo "SOMETHING00000076XYZ" | sed "s/[a-zA-Z]//g" | sed "s/^0*//"

现在,当我创建一个深层链接时:“ http://hostname/#/users/user-detail/:id

@IonicPage({
  name: 'UsersPage',
  segment: 'users'
})
@IonicPage({
  name: 'UserDetailPage',
  segment: 'user-detail/:id'
})

当应用程序已经运行时,当我尝试打开该URL时,一切正常,但是当我尝试从该URL启动应用程序时,它的第一个更改自:

@Injectable() export class DeeplinksProvider { private router: any; constructor( protected platform: Platform, protected deeplinks: Deeplinks, public app: App, ) { } subscribe() { this.platform.ready().then(() => { console.log('Successfully subscribed to deeplinking'); this.router = this.deeplinks.route({ '/users/user-detail/:id': 'UserDetailPage', }); this.router.subscribe((match) => { const nav = this.app.getRootNav(); console.log("Deeplinking matched route:"); console.log(match); this.redirectToRoute(nav, match); }, (nomatch) => { console.log("Deeplinking nomatch route:"); console.log(nomatch); }); }); } ...

http://hostname/#/users/user-detail/1234

那之后,我可以在控制台中看到所有有关深度链接的日志:

http://hostname/#/users

Successfully subscribed to deeplinking

Deeplinking matched route:

是否有任何方法可以在启动时禁用该细分导航,或者有任何方法可以解决此问题?

我来自package.json的版本:

{url: "http://localhost/#/users", path: "/", host: "localhost", fragment: "#/users"}

0 个答案:

没有答案