Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 867 Bytes

File metadata and controls

46 lines (31 loc) · 867 Bytes

本頁包含 Elm 0.18

主程式(Main)

最後,修改 src/Main.elm 呼叫 initialModel

module Main exposing (..)

import Html exposing (Html, div, text, program)
import Messages exposing (Msg)
import Models exposing (Model, initialModel)
import Update exposing (update)
import View exposing (view)


init : ( Model, Cmd Msg )
init =
    ( initialModel, Cmd.none )


subscriptions : Model -> Sub Msg
subscriptions model =
  Sub.none

-- 主程式

main : Program Never Model Msg
main =
    program
    { init = init
    , view = view
    , update = update
    , subscriptions = subscriptions
    }

在匯入及 init 新增 initialModel


當執行應用程式時,會看見列表中有一位用戶。

Screenshot

應用程式看起來像是 https://github.com/sporto/elm-tutorial-app/tree/04-resources