【发布时间】:2021-07-09 23:08:23
【问题描述】:
我在 Elm 中有一个 Html.img,我想在其中添加 src 和 class。我怎么做?谢谢!
【问题讨论】:
我在 Elm 中有一个 Html.img,我想在其中添加 src 和 class。我怎么做?谢谢!
【问题讨论】:
import Html exposing (img, div)
import Html.Attributes exposing (class, src)
view : Model -> Html Msg
view model =
div []
[ img [ class "my-img", src "https://loremflickr.com/320/240" ] []
]
查看实时示例here!
或者阅读更多关于Html.Attributes的信息。
【讨论】: