История изменений
Исправление
vertexua,
(текущая версия)
:
Elm, тут все вместе, с HTML. Типы контроллируются через эту границу тоже
module Main exposing (..)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main =
Browser.sandbox { init = init, update = update, view = view }
type alias Model = Int
init : Model
init = 0
type Msg
= Increment
update : Msg -> Model -> Model
update msg model =
case msg of
Increment -> model + 1
view : Model -> Html Msg
view model =
div []
[ div [] [ text (String.fromInt model) ]
, button [ onClick Increment ] [ text "+" ]
]
Тут потыкай https://elm-lang.org/examples
Исправление
vertexua,
:
Elm, тут все вместе, с HTML. Типы контроллируются через эту границу тоже
module Main exposing (..)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main =
Browser.sandbox { init = init, update = update, view = view }
type alias Model = Int
init : Model
init = 0
type Msg
= Increment
update : Msg -> Model -> Model
update msg model =
case msg of
Increment -> model + 1
view : Model -> Html Msg
view model =
div []
[ div [] [ text (String.fromInt model) ]
, button [ onClick Increment ] [ text "+" ]
]
Тут потыкай https://elm-lang.org/examples
Исправление
vertexua,
:
Elm, тут все вместе, с HTML. Типы контроллируются через эту границу тоже
module Main exposing (..)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main =
Browser.sandbox { init = init, update = update, view = view }
type alias Model = Int
init : Model
init = 0
type Msg
= Increment
update : Msg -> Model -> Model
update msg model =
case msg of
Increment -> model + 1
view : Model -> Html Msg
view model =
div []
[ div [] [ text (String.fromInt model) ]
, button [ onClick Increment ] [ text "+" ]
]
Исходная версия
vertexua,
:
Elm, тут все вместе, с HTML
module Main exposing (..)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main =
Browser.sandbox { init = init, update = update, view = view }
type alias Model = Int
init : Model
init = 0
type Msg
= Increment
update : Msg -> Model -> Model
update msg model =
case msg of
Increment -> model + 1
view : Model -> Html Msg
view model =
div []
[ div [] [ text (String.fromInt model) ]
, button [ onClick Increment ] [ text "+" ]
]