简体   繁体   English

使用Aurelia中的href发送多个数据

[英]Send multiple data using href in Aurelia

How to send multiple data using href in Aurelia? 如何在Aurelia中使用href发送多个数据?

This works: <a href="#/candidate/upload/${cid}?t=${item.heading}">

Just need the syntax. 只需要语法。

Not working:<a href="#/candidate/upload/${cid}?t=${item.heading};s=${item.sw_casedocumentid}">

This can be done using the route-href custom attribute. 可以使用route-href自定义属性来完成。 I'm guessing you have a route configuration that looks something like this: 我猜你有一个看起来像这样的路由配置:

{ route: 'candidate/upload/:cid', name: 'upload', ... }

The cool thing with the router is that if you pass it parameters that don't exist on a route, it will just add them to the query string: 路由器的妙处在于,如果您将路由中不存在的参数传递给它,它将仅将它们添加到查询字符串中:

<a route-href="route: 'upload', 
               params.bind: { cid: cid; t: item.heading; s: item.sw_casedocumentid }"></a>

This will produce a link that looks how you want it to look. 这将产生一个链接,该链接看起来像您想要的样子。

解决方案:只需要在数据之间添加&

<a href="#/candidate/upload/${cid}?t=${item.heading}&s=${item.sw_casedocumentid}">

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

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