加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 如何在simple_form 2中的包装器中向输入组件添

发布时间:2020-12-16 20:46:39 所属栏目:百科 来源:网络整理
导读:在使用自定义包装器时,我正在尝试在我的输入字段中使用class =“text”:hinted in simple_form 2.0.0.rc config.wrappers :hinted do |b| b.use :input,:class = "text"end 但是输出没有那个类,我试过了 :wrap_with = {:class = 'text'} 无济于事 有谁知道
在使用自定义包装器时,我正在尝试在我的输入字段中使用class =“text”:hinted in simple_form 2.0.0.rc
config.wrappers :hinted do |b|
  b.use :input,:class => "text"
end

但是输出没有那个类,我试过了

:wrap_with => {:class => 'text'}

无济于事

有谁知道这是如何做的?

谢谢!

解决方法

目前没有办法做到这一点.如果需要,您可以使用这样的默认选项.
<%= simple_form_for(@user,:defaults => { :input_html => { :class => "text" } }) do %>
  <%= f.input :name %>
<% end %>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读