syntax - 在文本输入下创建按钮时如何修复错误?
问题描述
我想在这两个文本输入下创建一个按钮。我刚刚超越了文档中的代码。但我得到这个错误:
该
div
函数需要 2 个参数,但它得到了 5 个。
我该如何解决这个问题?
-- VIEW
view : Model -> Html Msg
view model =
div []
[ input [ placeholder "Team 1", style "width" "300px", style "height" "30px", style "font-size" "25px", value model.content ] []
, input [ placeholder "Strength", style "width" "300px", style "height" "30px", style "font-size" "25px", value model.content ] []
]
div []
[ button [ style "color" "white", style "height" "60px", style "font-size" "30px", style "margin-right" "70px"]
]
解决方案
您的代码,省略了孩子,可以重新格式化为
div [] [ ... ] div [] [ ... ]
你明白为什么编译器认为你给出了div
五个参数吗?
由于view
应该返回单个元素,因此您必须将div
's 包装在其他元素中,例如另一个div
:
div []
[ div [] [ ... ]
, div [] [ ... ]
]
推荐阅读
- spring-boot - 无法将环境变量绑定到 application.properties
- php - PHP数组从用户输入改变字体颜色
- python-3.x - 如何使用 python 中的换行符读取用户输入,打印为新行?
- c# - 使用动作
对于一个事件 - google-bigquery - 解析列中具有动态键的 JSON 值并将 JSON 转换为 BigQuery 中的记录列结构
- c# - 将 DateTime 更新到数据库会引发 SqlTypeException - SqlDateTime 溢出
- excel - 在刀片视图中查看 excel 文件的最佳方式
- ruby - 现有文本字段的 Rails 操作文本
- android - 不使用多部分发送文件
- getstream-io - 尝试订阅 getStream Websocket 时出现错误