我有一个JSON文件,在Jade Mixin中调用以显示文本。但是,我需要在其中一个JSON字段中插入一个break标记,并且不知道如何在Jade Mixin中完成此操作。我无法在任何地方找到相关信息。
这是JSON文件:
"features": {
"employers": {
"title": "For Employers",
"description": "Company corporate financial wellness program is designed to help employers lessen financial stress in the workplace, increase retirement readiness, and strengthen workplace culture.<br />Company offers a holistic approach to corporate financial wellness.",
"featureList": [
{
"iconSlug": "puzzle",
"title": "Easy Implementation",
"description": "Company provides a robust, custom marketing and communication plan to help drive program awareness and engagement."
},
{
"iconSlug": "rays",
"title": "Ongoing Engagement",
"description": "Get metrics around your employees’ engagement with the program and workplace impact."
},
{
"iconSlug": "dollarSign",
"title": "Affordable Pricing",
"description": "Explore our pricing options for all company sizes, including low, per- employee rates that can be paid out of ERISA budgets."
}
],
"cta": {
"title": "Contact our team",
"class": "trigger-emailFormScroll"
}
}
以下是Mixin的内容:
mixin FeaturesModule(config)
h3.lvHeading.lvHeading-size3.lvHeading-main= config.title
h5.lvHeading.lvHeading-size5= config.description
- if (config.cta && typeof config.cta.newPage === "undefined") { config.cta.newPage = true; }
.layout-stdGrid
each feature, i in config.featureList
.stdGrid-col8.stdGrid-col-thin.padding-2
abbr(class= "icon-mktgLight-" + feature.iconSlug)
h6.lvHeading.lvHeading-size5.lvHeading-main!= feature.title
span.block= feature.description
- if (config.featuredLink)
a.link-featured.margin-Y-1.block(href= config.featuredLink.href, name=config.featuredLink.title, target= "_blank")= config.featuredLink.title
- else if (config.cta)
- if (config.cta.href)
a.button.button-wide(href= config.cta.href, target= (config.cta.newPage) ? "_blank" : undefined)= config.cta.title
- else
- var ctaClass = config.cta.class || "";
button.button.button-wide(class= ctaClass)= config.cta.title
span.block = feature.description是我目前正在使用的内容。使mixin解释break标记的最佳方法是什么,因此它不会在页面上以文本形式打印?
提前致谢。
答案 0 :(得分:2)
两种解决方案都有效:
span.block!=feature.description
span.block!{feature.description}