我有一个存储在javascript变量中的大量数组。我的一个数组的一个例子是:
{
index: 6,
template: 2,
title: "Innovation Center",
shortname: 'innov',
projectActive: 'true',
subtitle: "Construct",
location: "alaska",
x: 1304,
y: 610,
image1: "img/watt.jpg",
image2: "img/image_2.jpg",
bgImage: "img/bgImage.jpg",
headline1: "Catapulting Ideas to Reality",
paragraph1: "A long paragraph of text",
headline2: "The Future Won't Wait, and Neither Will We",
paragraph2: "This is a long paragraph of text",
listTitle: "Innovative resources include: ",
listItems: [
{ item: "Visual analytics" },
{ item: "Communication skills development" },
]
},
使用handlebars.js将其打印成HTML:
<div class="header" style="background-image: url( {{ bgImage }} );" >
<div class="container">
<div class="col-sm-12">
<h1> {{ title }} </h1>
<h4> {{ subtitle }} </h4>
</div>
</div>
</div>
<div class="container">
<div class="row paragraph1">
<div class="col-sm-6" >
<div class="image1" style="background-image: url( {{image1}} );">
</div>
</div>
<div class="col-sm-6">
<h2> {{ headline1 }}</h2>
<p> {{ paragraph1 }} </p>
</div>
</div>
我的问题是我如何在“&#39;段落中包含一些文字?使用html的键值。所以我想做的是:
paragraph1: "A long <a href="google.com">paragraph</a> of text",
但这只是在页面上吐出代码。任何帮助将不胜感激。