简体   繁体   English

如何使page.js在同一站点上的单页和多页中工作?

[英]How to get page.js to work in a single page AND multipage on the same site?

am using page.js for routing in a Grails application using '/' to point /HomeController/index to serve up a single page web application. 我正在使用page.js在Grails应用程序中进行路由,并使用“ /”指向/ HomeController / index来提供单个页面的Web应用程序。 I just installed Grails Spring Security Core plugin, and I am using the Grails scaffolding to create the User Admin/Permissions views with the goal of serving them in the traditional multi-page way to avoid having to do a lot of UI work on admin pages. 我刚刚安装了Grails Spring Security Core插件,并且正在使用Grails脚手架来创建User Admin / Permissions视图,目的是以传统的多页面方式为它们提供服务,从而不必在管理页面上进行大量的UI工作。 The bulk of the application will be served using single page architecture, with just the admin pages being served multi-page. 该应用程序的大部分内容将使用单页体系结构提供,只有管理页面才能提供多页。

In their documentation, page.js says, "By default when a route is not matched, page.js will invoke page.stop() to unbind itself, and proceed with redirecting to the location requested. This means you may use page.js with a multi-page application without explicitly binding to certain links." page.js在其文档中说:“默认情况下,当路由不匹配时,page.js将调用page.stop()解除绑定,并继续重定向到请求的位置。这意味着您可以使用page.js无需明确绑定到某些链接的多页面应用程序。” But, I cannot get it to work... 但是,我无法使其正常工作...

I am using page.js like so: 我正在像这样使用page.js:

page('/', SCM.Dashboard.home);
page('/hx', SCM.HX.summary);
page('/hx/vendor', SCM.HX.vendors);
page('/hx/customer', SCM.HX.customers);
page('/customer/list', SCM.Customer.list);
page('/maintenance/activity', SCM.Maintenance.activity);
page();

When I click a link to '/user', based on their documentation, I expect it to forward directly to ' http://domain.com/user '. 当我单击链接到“ / user”时,根据他们的文档,我希望它直接转发到“ http://domain.com/user ”。 It adds the correct path to browser location bar ( http://domain.com/user ), but the browser never forwards to the page. 它将正确的路径添加到浏览器位置栏( http://domain.com/user ),但是浏览器从不转发到页面。 In order to see the page, I have to click the link, and after the location bar has changed, if I refresh the browser window, the correct page appears - obviously unacceptable. 为了查看该页面,我必须单击链接,并且更改位置栏后,如果刷新浏览器窗口,则会显示正确的页面-显然不可接受。 Yet, I cannot find in their documentation how to implement this correctly. 但是,我无法在他们的文档中找到如何正确实施此方法。 I have experimented with various settings for hours with no luck. 我已经尝试了好几个小时没有运气的各种设置。 If I comment out the page.js code above, the multi-page admin pages work fine, and I am able to navigate from page to page no problem. 如果我注释掉上面的page.js代码,则多页面管理页面可以正常工作,并且我可以在页面之间导航。 Has anyone solved this problem? 有谁解决了这个问题?

I just upgraded from version 1.4.0 to version 1.5.0 and it links between the Single page (Main app) and Multi-page (Admin functionality) portions of the application seamlessly with no configuration needed!! 我刚刚从版本1.4.0升级到版本1.5.0,它可以无缝链接应用程序的单页(主应用程序)和多页(管理功能)部分,而无需进行配置! Excellent feature addition! 出色的功能!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM