as: :text
时才具有文本大小。甚至有可能吗?我不确定您在这里遇到什么困难,添加一些类或样式:
# config/initializers/simple_form.rb
SimpleForm.setup do |config|
config.wrappers :default do |b|
b.use :label
# use css classes
b.use :input, class: "input w-100"
# # or inline style
# b.use :input, class: "input", style: "width:100%"
end
end
https://github.com/heartcombo/simple_form#configuration:
# config/initializers/simple_form.rb
# remap text to be a string field
SimpleForm::FormBuilder.mappings[:text] = SimpleForm::Inputs::StringInput
# use `as: :textarea` to get a text area field
SimpleForm::FormBuilder.mappings[:textarea] = SimpleForm::Inputs::TextInput