出于某种原因,Jade似乎将双引号的HTML实体添加到_id字符串的开头和结尾,因为它没有与空字符串连接。
玉:
var post = {_id: ObjectId("551ce90c036474a3805e30cf")};
button(data-id=post._id, data-action='give') Give
HTML:
<button data-id=""551ce90c036474a3805e30cf"" data-action="give">Give</button>
玉:
var post = {_id: ObjectId("551ce90c036474a3805e30cf")};
button(data-id='' + post._id, data-action='give') Give
HTML:
<button data-id="551ce90c036474a3805e30cf" data-action="give">Give</button>``
无论如何要解决这个问题,还是我做错了什么?