我想添加 fontawesome 图标
<i class="fa fa-trash-o"></i>
代替“毁灭”
<%= link_to 'Destroy', post_path(post), method: :delete, data: { confirm: 'Are you sure?' } %>
我想添加 fontawesome 图标
<i class="fa fa-trash-o"></i>
代替“毁灭”
<%= link_to 'Destroy', post_path(post), method: :delete, data: { confirm: 'Are you sure?' } %>
你可以试试
<%= link_to(
content_tag(
:i,
nil,
class: 'fa fa-trash-o'
),
method: :delete,
data: {
confirm: 'Are you sure?'
}
)
%>
你可以尝试其他不:i
喜欢的东西,:div
如果你想要里面的文本,<i>TEXT</i>
你可以尝试使用 TEXT 而不是 nil,希望这对你有所帮助。
你也可以像这样使用一个块
<%= link_to post_path(post), method: :delete, data: { confirm: 'Are you sure?' } do %>
<i class="fa fa-trash-o"></i>
<% end %>