Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个向量名称-lst 作为 ["John" "Mary" "Watson" "James"],
我想将它们显示为列表项,我该如何使用打嗝?
就像是
[:ul (for [name name-list] [:li name])]
将返回 [:li ] 之间的列表 [:ul ] 而不是重复。一定有更好的东西。我对打嗝比较陌生,我搜索但找不到任何东西。
将数据结构提供给 Hiccup 后,您应该会得到预期的结果:
(require '[hiccup.core :refer [html]]) (def names ["John" "Mary" "Watson" "James"]) (html [:ul (for [name names] [:li name])]) ;=> "<ul><li>John</li><li>Mary</li><li>Watson</li><li>James</li></ul>"