新手问题 在 Slim 模版文件中怎么写如下的格式内容,谢谢

justend · 2013年03月20日 · 最后由 luikore 回复于 2013年03月23日 · 2721 次阅读

div class="alert alert-<%= "key" %>"

请问中间的<%= 怎么表示呢,谢谢

class= 后面用单引号?

你写错了吧?应该是这样的吧:

<div class="alert alert-<%= key %>">

Slim:

.alert class="alert-#{key}"
.alert class=("alert-#{key}")

多谢楼上几位,没想到这么快就得到回复,非常感谢:)

#3 楼 @Rei 呵呵,修改后我们的一样了。;)

#5 楼 @fredwu 奥,原来可以不带括号啊


<%= link_to "delete", feed_item, method: :delete,
                                 data: { confirm: "You sure?" },
                                 title: feed_item.content %>

写成这样不对,这个怎么写呢,谢谢

= link_to "delete", feed_item, method: :delete, \
                                 data: { confirm: "You sure?" }, \
                                 title: feed_item.content

有人能帮忙告诉我我在楼上说的问题吗?谢谢

#8 楼 @justend 这么写没问题的,问题应该在别的地方

需要 登录 后方可回复, 如果你还没有账号请 注册新账号