如何在 json 数组对象中添加 <a> HTML 标签
how to add <a> HTML tag in json array object
我是创建数组对象的新手,我不知道如何在 json 文件的标签中添加 link
json 对象代码:
powerUpList: [
{
id: 8,
name: 'Automate your API column type ',
description: 'Set automated schedules (daily, 3 days, weekly, biweekly, monthly) on your API column type and keep yourself up to date at all times. Note: Please check total limits based on your plan. ',
category: 'Automation',
status: 0,
},
{
id: 9,
name: 'Google Drive Sync ',
description: 'Sync your stacks directly with your Google Drive Account and open/create stacks from Google Drive.',
category: 'Apps',
status: 0,
},
{
id: 10,
name: 'Google Chrome Extension',
description: 'Clip information from any webpage, through a custom google chrome extension.<a href="https://chrome.google.com/webstore/detail/stackby-webclipper/kjkhpjfgbiedbaohfklagjmcdjhamoje" > Download it from here.</a>',
category: 'Apps',
status: 0,
},
{
id: 11,
name: 'Color Formatting on Rows',
description: 'Add colors on rows based on pre-defined conditions. ',
category: 'Data Transformation',
status: 0,
},
{
id: 12,
name: 'Database Snapshots',
description: 'Take a manual, point-in-time snapshot of your database and recover it at a later time. Note: Duration for snapshot history is based on the plans. ',
category: 'Data Recovery',
status: 1,
},
],
powerUpCategoryList: [
'Data Recovery',
'Import',
'Data Transformation',
'Sharing',
'Automation',
'Apps',
],
这是我的json文件代码
这是 .ejs 中的实际代码,其中所有实例都执行,手风琴不关闭,
powerup.ejs
<div class="col-md-9" id="root">
<div role="tablist" id="accordion-1">
<%for (var i = 0; i < powerUpList.length; i++) { %>
<div class="card">
<div class="card-header" role="tab">
<a data-toggle="collapse" aria-expanded="true" aria-controls="accordion-1 .item-<%= i+1 %>" href="div#accordion-1 .item-<%= i+1 %>"><%= powerUpList[i].name%></a>
<%if (powerUpList[i].status == 0) { %>
<a class="live-lable status-live" >
Live
</a>
<%}else if(powerUpList[i].status == 1){-%>
<a class="live-lable status-comingsoon" >
Coming soon
</a>
<%}else if(powerUpList[i].status == 2){-%>
<a class="live-lable status-beta" >
In-Beta
</a>
<%}-%>
</div>
<div class="collapse show item-<%= i+1 %>" role="tabpanel" data-parent="#accordion-1">
<div class="card-body">
<p class="card-text" ><%= powerUpList[i].description%></p>
</div>
</div>
</div>
<%}-%>
</div>
</div>
这里,我要显示在 Download it from here.', in as download link , but it show whole url ,
使用 ejs 模板,
你可以输出原始数据(打印html)
使用 <%- your.rentry %>
而不是 <%= your.rentry %>
如您在 documentation 中所见:
<%= Outputs the value into the template (HTML escaped)
<%- Outputs the unescaped value into the template
所以你最后的描述应该是这样的:
<div class="card-body">
<p class="card-text" ><%- powerUpList[i].description %></p>
</div>
我是创建数组对象的新手,我不知道如何在 json 文件的标签中添加 link
json 对象代码:
powerUpList: [
{
id: 8,
name: 'Automate your API column type ',
description: 'Set automated schedules (daily, 3 days, weekly, biweekly, monthly) on your API column type and keep yourself up to date at all times. Note: Please check total limits based on your plan. ',
category: 'Automation',
status: 0,
},
{
id: 9,
name: 'Google Drive Sync ',
description: 'Sync your stacks directly with your Google Drive Account and open/create stacks from Google Drive.',
category: 'Apps',
status: 0,
},
{
id: 10,
name: 'Google Chrome Extension',
description: 'Clip information from any webpage, through a custom google chrome extension.<a href="https://chrome.google.com/webstore/detail/stackby-webclipper/kjkhpjfgbiedbaohfklagjmcdjhamoje" > Download it from here.</a>',
category: 'Apps',
status: 0,
},
{
id: 11,
name: 'Color Formatting on Rows',
description: 'Add colors on rows based on pre-defined conditions. ',
category: 'Data Transformation',
status: 0,
},
{
id: 12,
name: 'Database Snapshots',
description: 'Take a manual, point-in-time snapshot of your database and recover it at a later time. Note: Duration for snapshot history is based on the plans. ',
category: 'Data Recovery',
status: 1,
},
],
powerUpCategoryList: [
'Data Recovery',
'Import',
'Data Transformation',
'Sharing',
'Automation',
'Apps',
],
这是我的json文件代码
这是 .ejs 中的实际代码,其中所有实例都执行,手风琴不关闭,
powerup.ejs
<div class="col-md-9" id="root">
<div role="tablist" id="accordion-1">
<%for (var i = 0; i < powerUpList.length; i++) { %>
<div class="card">
<div class="card-header" role="tab">
<a data-toggle="collapse" aria-expanded="true" aria-controls="accordion-1 .item-<%= i+1 %>" href="div#accordion-1 .item-<%= i+1 %>"><%= powerUpList[i].name%></a>
<%if (powerUpList[i].status == 0) { %>
<a class="live-lable status-live" >
Live
</a>
<%}else if(powerUpList[i].status == 1){-%>
<a class="live-lable status-comingsoon" >
Coming soon
</a>
<%}else if(powerUpList[i].status == 2){-%>
<a class="live-lable status-beta" >
In-Beta
</a>
<%}-%>
</div>
<div class="collapse show item-<%= i+1 %>" role="tabpanel" data-parent="#accordion-1">
<div class="card-body">
<p class="card-text" ><%= powerUpList[i].description%></p>
</div>
</div>
</div>
<%}-%>
</div>
</div>
这里,我要显示在 Download it from here.', in as download link , but it show whole url ,
使用 ejs 模板,
你可以输出原始数据(打印html)
使用 <%- your.rentry %>
而不是 <%= your.rentry %>
如您在 documentation 中所见:
<%= Outputs the value into the template (HTML escaped) <%- Outputs the unescaped value into the template
所以你最后的描述应该是这样的:
<div class="card-body">
<p class="card-text" ><%- powerUpList[i].description %></p>
</div>