安装后,当我在命令行上输入module Main exposing (..)
import Html
import Html.Events as Hev
import Html.Attributes as Hat
import Json.Decode as Json
main : Program Never Model Msg
main =
Html.beginnerProgram
{ model = ""
, update = update
, view = view
}
type Msg = NewText String
type alias Model = String
view : Model -> Html.Html Msg
view model =
Html.div
[ Hat.contenteditable True
, Hev.on "input" (Json.map NewText targetTextContent)
, Hat.style
[ ("border", "1px solid darkgray") ]
]
[ Html.text model
]
targetTextContent : Json.Decoder String
targetTextContent =
Json.at ["target", "innerText"] Json.string
update : Msg -> Model -> Model
update msg model =
case msg of
NewText text -> text
或node -v
时,它会抛出错误:
npm -v
请帮我解决。