Polymer 聚合物1.0更多布线

Polymer 聚合物1.0更多布线,polymer,polymer-1.0,Polymer,Polymer 1.0,聚合物:1.0.3 更多路由:1.0.0 聚合物“更多布线”存在一些问题。那些是- 1) 在控制台上获取此日志- [dom-bind::_annotatedComputationEffect]: compute method `urlFor` not defined 2) 第一级路由工作(即使我收到这些错误/警告消息)。但是第二级路由(我指的是嵌套路由)不起作用。在“用户”页面上,按名称不会使我进入“用户信息”页面。事实上,该名称不会显示为链接,而是显示为文本。这是我的密码- 我的“routi

聚合物:1.0.3 更多路由:1.0.0

聚合物“更多布线”存在一些问题。那些是-

1) 在控制台上获取此日志-

[dom-bind::_annotatedComputationEffect]: compute method `urlFor` not defined
2) 第一级路由工作(即使我收到这些错误/警告消息)。但是第二级路由(我指的是嵌套路由)不起作用。在“用户”页面上,按名称不会使我进入“用户信息”页面。事实上,该名称不会显示为链接,而是显示为文本。这是我的密码-

我的“routing.html”--


对于1.0(可能更早),Polymer停止支持数据绑定()中的表达式。谢天谢地,您仍然可以调用绑定中的函数(称为“”

据我所知,
urlFor()
方法必须稍微过于复杂,不能用作计算绑定(params对象不是依赖属性)。我可以通过将
urlFor()
包装到一个更简单的函数中来实现它,该函数可以作为计算绑定使用,如下所示:

<more-routing-config driver="path"></more-routing-config>
<more-route name="users" path="/users">
  <more-route name="user-info" path="/:name"></more-route>
</more-route>

<template is="dom-bind">
  <a href="{{makeUrl('user-info', 'Rob')}}">Rob</a>
</template>

<script>
  var template = document.querySelector('template');
  template.makeUrl = function(route, name) {
    return MoreRouting.urlFor(route, {name:name});
  };
</script>

导入HTML文件后,您将导入
更多路由
文件夹。我不知道这到底能做什么,但我打赌它不应该存在。@Zikes:不确定你的意思,但在我的“elements.html”中,我在导入html页面之前已经移动了“routes.html”的导入。但是在您导入的第一个代码块
more routing/more routing.html
和导入的
more routing/
中仍然存在相同的代码。第二个可能应该删除,可能会导致意外行为。@Zikes:是的,这是一个打字错误。我去掉了它,解决了我的一个问题。但其他或主要问题仍然存在。嵌套路由无效。谢谢:)是的,我知道它就像你提到的那样工作。但这仍然不能消除在控制台上打印的错误。它在创建URL时工作得非常好。但所选参数在演示视频中提到的
中无法访问
<template is="dom-bind">
  <template is="dom-repeat" items="{{users}}">
    <a href="{{makeUrl('user-info', item)}}">{{item.name}}</a>
  </template>
</template>

<script>
  var template = document.querySelector('template');
  template.makeUrl = function(route, user) {
    return MoreRouting.urlFor(route, {name:user.name});
  };
</script>