在 Freemarker 中合并地图

发布于 2024-12-27 20:53:40 字数 372 浏览 6 评论 0原文


我无法找到有关如何合并两个哈希映射的任何文档。这就是我想要达到的目标

<选择 <@render_attrs commonattrs.合并({"class":"select"}) /> > ....

<#macro render_attrs attrs>
<#list attrs?键作为键>
<#if attrs[key]!="">
${key}="${attrs[key]}"


I'm unable to find any documentation on how to merge two hash maps. This is what I am trying to acheive

<select
<@render_attrs commonattrs.merge({"class":"select"}) /> > ....

<#macro render_attrs attrs>
<#list attrs?keys as key>
<#if attrs[key]!="">
${key}="${attrs[key]}"
</#if>
</#list>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日裸衫吸 2025-01-03 20:53:40
commonattrs + {"class": "select"}

它记录在这里:http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_hashop

commonattrs + {"class": "select"}

It's documented here: http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_hashop

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文