使用单词和索引作为密钥,在Clojure和打ic中添加独特的键
我有一个快速的问题。我正在从事一个Clojure项目。我想在每个LI标签中添加唯一的密钥,例如:
(defn test [text]
[:li {:key :index} text])
如何设置诸如“ hi+index ”之类的键?
我试过
{:key(str“ hi”索引)}
但它不起作用。我是Clojure和Hiccup的新手。
非常感谢。
I have a quick question. I'm working on a Clojure project. I want to add unique key to each li tag, like this:
(defn test [text]
[:li {:key :index} text])
How I can set keys like "hi+index"?
I tried
{:key (str "hi" index)}
but it does not working. I'm new to Clojure and hiccup.
Thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在某个地方犯了一个错误。如有疑问,请使用一些测试代码询问计算机:
结果,
我喜欢使用此模板项目< /a>用于如上所述的快速测试。只需克隆它,然后将一些示例代码扔进
test/clj/tst/demo/core.clj
档案,走开了!
You are making a mistake somewhere. When in doubt, ask the computer with some test code:
with result
I like to use this template project for quick tests like the above. Just clone it and throw some sample code into the
test/clj/tst/demo/core.clj
file, and away you go!