有没有 select_tag 像 Phoenix 上的 RoR

Are there any select_tag like RoR on Phoenix

Rails 有 select_tag 没有形式。 phoenix有同类吗select_tag?

我一页有这么多项目,所以我无法制作表格。 所以我不能使用 form_forselect f 标签。

Phoenix.HTML 包含 tag, content_tag, form_tag and options_for_select 以构建 html(表单)元素。

例如:

content_tag "select", name: "color" do
  options_for_select ["Blue": "blue", "Red": "red"], "blue"
end

应该呈现:

<select name="color">
  <option value="blue" selected="selected">Blue</option>
  <option value="red">Red</option>
</select>

由此,您可以构建自己的 select_tag 函数。