下面的代码块需要小的语法调整。
我需要的是/
和title
之间的headline
。该位是ejs
代码。
<div class="go-here"></div>
<script type="text/javascript"
src="https://example.com/embed.js"
data-target=".go-here"
data-slug="<%= [post.title,post.headline] %>">
</script>
所有不成功之后:
data-slug="<%= [post.title,post.headline].join('/') %>"
data-slug="<%= [post.title,'/',post.headline] %>"
data-slug="<%= [post.title + '/' + post.headline] %>"
如何成功将其放置在/
和title
之间的headline
中????
答案 0 :(得分:1)
尝试一下
<% var slug =['title','headline']%>
<script type="text/javascript" src="https://example.com/embed.js" data-target=".go-here" data-slug="<%= slug.join('/')%>"></script>