我正在尝试呈现以下列表:
var servicesList1 = {
services : [
{title: "Service 1 Lorem", category: "Category 1", imageClass : "", description: "Lorem ipsum dolor sit amet consectetur adipiscing elit aliquam interdum."},
{title: "Service 2 Lorem", category: "Category 1", imageClass : "", description: "Lorem ipsum dolor sit amet consectetur adipiscing elit aliquam interdum."},
{title: "Service 3 Lorem", category: "Category 1", imageClass : "", description: "Lorem ipsum dolor sit amet consectetur adipiscing elit aliquam interdum."},
{title: "Service 4 Lorem", category: "Category 1", imageClass : "", description: "Lorem ipsum dolor sit amet consectetur adipiscing elit aliquam interdum."},
{title: "Service 5 Lorem", category: "Category 2", imageClass : "", description: "Lorem ipsum dolor sit amet consectetur adipiscing elit aliquam interdum."},
{title: "Service 6 Lorem", category: "Category 2", imageClass : "", description: "Lorem ipsum dolor sit amet consectetur adipiscing elit aliquam interdum."},
{title: "Service 7 Lorem", category: "Category 2", imageClass : "", description: "Lorem ipsum dolor sit amet consectetur adipiscing elit aliquam interdum."},
{title: "Service 8 Lorem", category: "Category 2", imageClass : "", description: "Lorem ipsum dolor sit amet consectetur adipiscing elit aliquam interdum."}
]
};
使用以下模板:
{{#services}}
<h3>{{category}}</h3>
<article>
<section class="service-image {{imageClass}}"></section>
<h4>{{title}}</h4>
<p>{{description}}</p>
</article>
{{/services}}
但我只希望 {{category}} 显示值何时发生变化。
IE
第一类
Title 1
Description 1
Title 2
Description 2
Title 3
Description 3
第 2 类
Title 4
Description 4
Title 5
Description 5
Title 6
Description 6
这是可行的吗?
谢谢,斯科特