2015-05-07 57 views
1

由于某些原因,这个Jade模板在变量输出周围添加了撇号,无论我尝试什么。您可以看到它是如何保存在底部的文档中的。有任何想法吗?Jade在输出中添加撇号

div.col-md-4.col-xs-12 
     div#currentImg 
      img(src=user.profileImg,class="currentImg") 

输出为:

<img src="'/uploads/e3670578cc1f0a235ae9686622f37d2c.jpg'" class="currentImg"> 

对于文档:

{ 
    "_id": { 
     "$oid": "5547e78c28d405cc236d4a02" 
    }, 
    "updated_at": { 
     "$date": "2015-05-07T20:20:16.537Z" 
    }, 
    "created_at": "Mon May 04 2015 17:41:32 GMT-0400 (EDT)", 
    "admin": false, 
    "lastName": "#####", 
    "firstName": "#####", 
    "email": "#####", 
    "password": "#####", 
    "callsign": "#####", 
    "uid": "#####", 
    "logPublic": true, 
    "profilePublic": true, 
    "__v": 0, 
    "profileImg": "/uploads/cf431a1d4cb451d9fb806a987845e8c3.png" 
} 
+0

是否做到这一点在其他情况下? – tadman

+0

@tadman我在页面上输出了其他变量,这些变量都没有围绕它们的撇号。它们都以相同的方式输出。 – MikeF

+2

您使用的是什么版本的Jade?我无法在最新版本中重现此行为。 http://codepen.io/Chevex/pen/GJoKQr?editors=100 – Chev

回答

0

假设你的JSON数据确实是正确的,并没有在它是错误的',没有理由这个错误应该发生在Jade中。

查看codepen(点击查看编译)。

一个建议是在玉的线,你要创建图像时使用的HTML,并设置它的src attrubute使用#{user.profileImg}这样:

<img src="#{user.profileImg}" class="currentImg">