问题描述
我在 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 的更多信息。