Aurelia href.bind 不工作

Aurelia href.bind is not working

我的路线:

{ route: 'weather/:woeid', href: '#/weather',  name: 'weatherd', moduleId: 'weatherd', nav: true, title: 'Weather' }

我的HTML:

<a href.bind="route: weatherd, params.bind: { woeid: cityId }">

我想构建这个url

#/weather/23423

我很难做到这一点。他们的文档中没有任何内容。 任何人请帮助

在这种情况下,您想使用 route-href 而不是 href.bind。

<a route-href="route: weatherd, params.bind: { woeid: cityId }">

您可以这样使用 href.bind:

<a href.bind="'weather/' + cityId" >

这可以在作弊的路由部分的 "Generating Route URLs" 小节中找到 sheet here

,替换为;

<a route-href="route: weatherd; params.bind: { woeid: cityId }"></a>

<a href.bind="route: weatherd, params.bind: { woeid: cityId }">

应该是

<a route-href="route: weatherd; params.bind: { woeid: cityId }">

使用 route-href,并使用分号代替逗号。