Jade 中的多个逻辑或运算符
Multiple logical OR Operators in Jade
很简单:
如果我的文件的 mimetype 是图像,我想制作一个 <img>
-Tag
case comment.fileType
when "image/png" || "image/gif" || "image/jpeg"
img(src="/files/#{comment.fileLink}")
无效
它适用于 png,但不适用于 jpeg 或 gif。
有什么技巧吗?
我认为这会起作用:
case comment.fileType
when "image/png"
when "image/gif"
when "image/jpeg"
img(src="/files/#{comment.fileLink}")
很简单:
如果我的文件的 mimetype 是图像,我想制作一个 <img>
-Tag
case comment.fileType
when "image/png" || "image/gif" || "image/jpeg"
img(src="/files/#{comment.fileLink}")
无效
它适用于 png,但不适用于 jpeg 或 gif。 有什么技巧吗?
我认为这会起作用:
case comment.fileType
when "image/png"
when "image/gif"
when "image/jpeg"
img(src="/files/#{comment.fileLink}")