将锚点添加到 javascript 数组以用于 handlebars.js
Add anchor to javascript array for use with handlebars.js
我在 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>
我的问题是如何使用 html 将一些文本包装在 'paragraph' 键值中。所以我想做的是:
paragraph1: "A long <a href="google.com">paragraph</a> of text",
但这只是在页面上吐出代码。任何帮助将不胜感激。
尝试使用三重存储:
{{{ paragraph1 }}}
我在 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>
我的问题是如何使用 html 将一些文本包装在 'paragraph' 键值中。所以我想做的是:
paragraph1: "A long <a href="google.com">paragraph</a> of text",
但这只是在页面上吐出代码。任何帮助将不胜感激。
尝试使用三重存储:
{{{ paragraph1 }}}