【发布时间】:2015-07-16 10:34:37
【问题描述】:
我正在使用 Polymer 1.0 构建一个应用程序,我想知道在路由方面我有哪些选择?看过more-routing但是不知道是不是兼容1.0,如果不支持的话,有没有类似more-routing的稳定的声明式路由解决方案?
【问题讨论】:
标签: javascript html url-routing polymer-1.0
我正在使用 Polymer 1.0 构建一个应用程序,我想知道在路由方面我有哪些选择?看过more-routing但是不知道是不是兼容1.0,如果不支持的话,有没有类似more-routing的稳定的声明式路由解决方案?
【问题讨论】:
标签: javascript html url-routing polymer-1.0
试试应用路由器: https://github.com/erikringsmuth/app-router
我在 1.0 中使用它,它运行良好。 我的路由是声明式设置的,我使用点击操作强制触发路由。
【讨论】:
我一直在使用 Pages.js 和 Polymer 1.0 来使用 hashbang 选项进行客户端路由。 例如。 http://localhost:8000/#!/home
Watch the routing Polycast 了解更多信息。
【讨论】:
这个很简洁,有一些功能,如nesting,query,params 它正在开发中,但非常有用
Easy-Router - http://customelements.io/MartinsThiago/easy-router
简单的使用示例
<page-admin path="#!/admin">
//Content
</page-admin>
【讨论】:
试试 dna-router。您只能在 HTML 中创建定义状态和路由。
设置路线:
<dna-new-state state='home' route='/home'></dna-new-state>
<dna-new-state state='user' route='/user/:id/'></dna-new-state>
通过以下方式创建视图:
<dna-view state='home' element='home-template'></dna-view>
如需详细文档,请访问:https://github.com/Saquib764/dna-router
【讨论】: