Handlebars.js:{{ this.url }} 在 <img src

如果我将它放在 / 等中,Handlebars.js 将不会解析代码。只要它在外面,它就可以正常工作。


<script id="entry-template" type="text/x-handlebars-template">

    <div class="entry">

        {{#each this}}

        <h1>{{title.rendered}}</h1>

        <div>{{content.rendered}}</div>


        <img src="{{url}}" alt=""/>

        {{/each}}

    </div>

</script>

我希望得到


<img src="http://localhost/image.jpg" alt=""/>

但输出如下:


<img src="{{url}}" alt=""/>

其他一切似乎都有效。循环也是。


喵喵时光机
浏览 230回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript