我正在尝试从此页面运行 Elm 输入示例。具体来说,文本字段示例,我收到一条错误消息,指出该Graphics.Input
模块丢失。
我在一个名为Main.elm
:
import Graphics.Input as Input
main = let (field, state) = Input.field "Type here!"
in lift2 display field state
display field state =
field `above` asText state
如果我运行elm-server
并导航到localhost:8000
,我会收到错误消息
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
Error: Module 'Graphics.Input' is missing. Compile with --make flag or load missing module in a separate JavaScript file.
The problem may stem from an improper usage of:
Input.field, above
编译项目elm --make Main.elm
给了我
elm: Graphics/Input.elm: openFile: does not exist (No such file or directory)
我需要做一些额外的事情来安装Graphic.Input
吗?
补充说明:
- 我在 Debian 机器上运行它,并使用
cabal install elm
最近(2013 年 6 月 15 日)安装它。当前版本标记为Elm-0.7.1.1
。 - 如果我跳进
chromium
JS 提示符并四处寻找,结果发现没有Elm.Graphics.Input
模块,但有一个Elm.Input
. 没有一个函数叫做field
,有一个类似的函数叫做textField
的函数叫做,但它不是可以简单互换的。
运行这个:
import Input
main = let (field, state) = textField "Type here!"
in lift2 display field state
display field state =
field `above` asText state
给我错误
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
TypeError: a is undefined
The problem may stem from an improper usage of:
above