Can mustache iterate a top-level array?

前端 未结 5 830
刺人心
刺人心 2020-12-04 08:21

My object looks like this:

[\'foo\',\'bar\',\'baz\']

And I want to use a mustache template to produce from it something like this:

5条回答
  •  有刺的猬
    2020-12-04 08:51

    I had the same problem this morning and after a little experimentation I discovered you can use the {{.}} to refer to the current element of an array:

      {{#yourList}}
    • {{.}}
    • {{/yourList}}

提交回复
热议问题