2015-06-19 110 views
1

很简单: 我想打一个<img> -Tag如果我的文件的媒体类型是图像多个逻辑或运算翡翠

case comment.fileType 
    when "image/png" || "image/gif" || "image/jpeg" 
    img(src="/files/#{comment.fileLink}") 

不起作用

它为PNG,但不适用于jpeg或gif。 有没有一招?

回答

0

我认为这将工作:

case comment.fileType 
    when "image/png" 
    when "image/gif" 
    when "image/jpeg" 
    img(src="/files/#{comment.fileLink}") 
+0

它,谢谢! –