gpt4 book ai didi

css - 如何使用 css、glyphicons 和符号格式化 f.submit?

转载 作者:数据小太阳 更新时间:2023-10-29 09:03:07 27 4
gpt4 key购买 nike

我们如何做到这一点:<%= f.submit :conceal %><span class="glyphicon glyphicon-plus"> 一起工作, 这个词 Private , 和 class: "btn" .

这里有一些尝试:

#This didn't make :conceal work
<%= button_tag(type: 'submit', class: "btn") do %>
<% :conceal %><span class="glyphicon glyphicon-plus"></span> Private
<% end %>

#This stopped :conceal from working too
<%= f.submit "Private", class: "btn" do %>
<% :conceal %>
<% end %>

#This ignored the 2nd line despite, do
<%= f.submit :conceal, class: "btn" do %>
<span class="glyphicon glyphicon-plus"></span> Private
<% end %>

Controller 中:

if (params[:commit] == 'conceal')
@valuation.conceal = true
end

最佳答案

使用 input[type=submit] 时恐怕无法实现带图标的按钮外观。

您必须使用按钮。请考虑以下内容:

<%= button_tag(type: "submit", class: "btn", name: "commit", value: "conceal") do %>
<span class="glyphicon glyphicon-plus"></span> Private
<% end %>

生成的 HTML 类似于:

<button name="commit" type="submit" class="btn" value="conceal">
<span class="glyphicon glyphicon-plus"></span> Private
</button>

希望对您有所帮助!

关于css - 如何使用 css、glyphicons 和符号格式化 f.submit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30565065/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com