gpt4 book ai didi

javascript - 将 Iron Router 参数传递给 pathFor Helper

转载 作者:行者123 更新时间:2023-11-28 00:39:08 25 4
gpt4 key购买 nike

当使用 pathFor 模板助手时,我们如何将 Router.current().params._id 传递给它?

以下代码

<a href="{{ pathFor 'myPage' _id=Router.current().params._id }}">

报错

Expected space ...e' _id=Router.current().params._id }}" cl...
^`

最佳答案

使用Router.current.params._id而不是Router.current().params._id。 Meteor 会动态检查属性值,如果遇到函数,就会调用它。

关于javascript - 将 Iron Router 参数传递给 pathFor Helper,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28135919/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com