如何在移动控件中应用深度链接
我正在尝试在最近的扩展库中使用移动控件。我已经设置了基本结构并且它似乎正在工作。但是,当我导航到某个页面时,我没有看到末尾带有页面名称的#。当我点击后退按钮时,我确实得到了“#home”应用。
如何将 # 应用于各个页面,以便在浏览器发出完全刷新或有人想要进行深层链接时它们会保留?
谢谢!
<xe:singlePageApp id="singlePageApp1"
selectedPageName="home">
<xe:appPage id="home" pageName="home">
<xe:djxmHeading id="djxmHeading0"
label="My Home Page">
</xe:djxmHeading>
<xe:djxmLineItem id="djxmLineItem3" label="Sell Items"
moveTo="mobilePage1">
</xe:djxmLineItem>
<xe:djxmLineItem id="djxmLineItem4" label="Sold Items"
moveTo="mobilePage2">
</xe:djxmLineItem>
</xe:appPage>
<xe:appPage id="appPage1" pageName="mobilePage1"
autoCreate="true">
<xe:djxmHeading id="djxmHeading1" label="Sell an Item"
moveTo="home" back="Back">
</xe:djxmHeading>
<xc:cc_SellItem></xc:cc_SellItem>
</xe:appPage>
<xe:appPage id="appPage2" pageName="mobilePage2">
<xe:djxmHeading id="djxmHeading2" moveTo="home" back="Back"
label="Sold Items">
</xe:djxmHeading>
<xp:panel>List of Sold Items will go here.</xp:panel></xe:appPage>
</xe:singlePageApp>
I'm trying to use mobile controls in a recent extension library. I've setup the basic structure and it seems to be working. However when I navigate to a page I don't get a # with the page name applied to the end. When I hit the back button I DO get a "#home" applied.
How do get the # to apply to the indivudal pages so they will stick if a full refresh is issued from the browser or someone wants to do deep linking?
Thanks!
<xe:singlePageApp id="singlePageApp1"
selectedPageName="home">
<xe:appPage id="home" pageName="home">
<xe:djxmHeading id="djxmHeading0"
label="My Home Page">
</xe:djxmHeading>
<xe:djxmLineItem id="djxmLineItem3" label="Sell Items"
moveTo="mobilePage1">
</xe:djxmLineItem>
<xe:djxmLineItem id="djxmLineItem4" label="Sold Items"
moveTo="mobilePage2">
</xe:djxmLineItem>
</xe:appPage>
<xe:appPage id="appPage1" pageName="mobilePage1"
autoCreate="true">
<xe:djxmHeading id="djxmHeading1" label="Sell an Item"
moveTo="home" back="Back">
</xe:djxmHeading>
<xc:cc_SellItem></xc:cc_SellItem>
</xe:appPage>
<xe:appPage id="appPage2" pageName="mobilePage2">
<xe:djxmHeading id="djxmHeading2" moveTo="home" back="Back"
label="Sold Items">
</xe:djxmHeading>
<xp:panel>List of Sold Items will go here.</xp:panel></xe:appPage>
</xe:singlePageApp>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需在 moveTo 属性中的页面名称中添加哈希 (#) 前缀即可:
查看 XPages 移动控件教程中的“moveTo 属性”。
You just need to add the hash (#) prefix to the page name in the moveTo property:
Have a look at "The moveTo property" in the XPages Mobile Controls Tutorial.
扩展库还包括动态内容组件。该组件有一个 useHash 属性,它引用 URL 中的 #。这应该允许您根据哈希值指定加载应用程序的哪一部分。
The Extension Library also includes a Dynamic Content component. This component has a useHash property, which refers to the # in the URL. This should allow you to specify which portion of the app is loaded based on the hash value.