看下面的代码
for story in book
if story.title.length < 140
- var storyTitle = story.title;
else
- var storyTitle = story.title.substring(0, 140) + '...';
.tiles
a(href= 'http://' + story.link)
img(src=story.thumbnail, width='150', height='150')
p Title: #{storyTitle}
p Date: #{story.time}
p Author: #{story.authorName}
Run Code Online (Sandbox Code Playgroud)
这对我有用.然而,它告诉我,在tmes我可以使用story.attribute,并且在必须使用#{story.attribute}的地方.
例如.如果我使用该线
p Title: storyTitle
Run Code Online (Sandbox Code Playgroud)
没有胡须,它只是在浏览器中打印字符串"Title:storyTitle".
另一个例子,如果我使用img(src=#{story.thumbnail}, width='150', height='150')
它,它不起作用,我在我的浏览器中得到一个HTML字符串(%20%20 ......东西...).
什么赋予了什么?
归档时间: |
|
查看次数: |
2601 次 |
最近记录: |