问题描述
在我使用 Simple_form_for 时的数字字段中,使用 Google Chrome 时,滚动条显示在字段的一侧.
In my numeric fields when using Simple_form_for, scroll bars are showed on the side of the fields when using Google Chrome.
如何阻止它们显示?
推荐答案
看一些代码会有帮助,但是
它们不是滚动条;它们是向上和向下箭头按钮,用于增加/减少指定 step
(默认为 1
)的 number
输入字段.详细了解number
输入类型
They're not scrollbars; they're up and down arrow buttons to increment/decrement the number
input field the specified step
(defaults to 1
). Learn more about the number
input type
默认情况下,模型的整数属性将使用 type="number"
作为字段使用 simple_form.
An integer attribute for your model by default will be rendered with type="number"
as a field using simple_form
.
要覆盖此行为,请使用 :as
选项指定字段的输入类型.
To override this behavior, specify the type of input for the field using the :as
option.
<%= f.input :your_field_name, as: :string %>
(这记录在 README.md
)
这篇关于数字字段 Simple_form_for的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!