将 elm-ui 按钮附加到列的第二个子项,键入错误

Append elm-ui button to 2nd child of column , type error

尝试在 elm 中创建一个类似于下图的简单销售点。

单击一个产品(Input.button,其类型为 Element msg?),然后在“订单列表”面板中创建所述按钮的记录。这也是一个 Input.button,可以通过单击从“订单”面板中删除。

目前我的 model 看起来像这样:

type alias Orders =
    { order : Element Msg } -- fully aware this is uppercase 'M', not matching what the column expects

type alias Model =
    { orderlist : List Orders }

将我的 model 添加到 view .. column [] [ model.orderlist ] 会出现以下错误:

This argument is a list of type: List (List Orders)

But column needs the 2nd argument to be: List (Element msg)

我在这里错过了什么?欢迎任何意见或想法。如果它可以帮助我实现创建此 POS 的目标,我也完全愿意转向不同的方向。 TIA :)

如错误消息所述,第二个参数应该是 Element msgList

但是您的 model.orderList 给了您一个记录列表 {order: Element Msg}

为了解决你需要在列表上映射并提取你的 Element Msg,比如:

... column [] (model.orderList |> List.map (\{order} -> order))