Last active
May 12, 2019 07:37
-
-
Save ababup1192/5fed428e35eeb8f57a1234438103b6a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div id="a">1</div> | |
<script> | |
const a = document.getElementById("a"); | |
const value = a.innerHTML; | |
a.innerText = value + 1; | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port module Main exposing (Model, Msg(..), init, main, update, view) | |
import Browser | |
import Html exposing (..) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (..) | |
-- --------------------------- | |
-- MODEL | |
-- --------------------------- | |
type alias Model = | |
Int | |
init : () -> ( Model, Cmd Msg ) | |
init _ = | |
( 1, Cmd.none ) | |
-- --------------------------- | |
-- UPDATE | |
-- --------------------------- | |
type Msg | |
= NoOp | |
update : Msg -> Model -> ( Model, Cmd Msg ) | |
update msg model = | |
( model, Cmd.none ) | |
-- --------------------------- | |
-- VIEW | |
-- --------------------------- | |
view model = | |
div [] [ text (String.fromInt (model + 1)) ] | |
-- --------------------------- | |
-- MAIN | |
-- --------------------------- | |
main : Program () Model Msg | |
main = | |
Browser.document | |
{ init = init | |
, update = update | |
, view = | |
\m -> | |
{ title = "viewの基本" | |
, body = [ view m ] | |
} | |
, subscriptions = \_ -> Sub.none | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment