Elm 0.19 Elm.MODULENAME.embed不是函数
我正在尝试创建一个简单的Elm项目,它只是将“hello world!”字符串插入到一个div中 这是我的密码: index.html:Elm 0.19 Elm.MODULENAME.embed不是函数,elm,Elm,我正在尝试创建一个简单的Elm项目,它只是将“hello world!”字符串插入到一个div中 这是我的密码: index.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>ELM Course</title> </head> <body> <div id="hello-wo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>ELM Course</title>
</head>
<body>
<div id="hello-world"></div>
<script src="hello.js"></script>
<script>
const myDiv = document.getElementById("hello-world");
const app = Elm.Hello.embed(myDiv);
</script>
</body>
</html>
我使用以下命令编译javascript:
elm make src/Hello.elm --output=hello.js
当我试图用浏览器打开index.html时,出现以下错误:
TypeError: Elm.Hello.embed is not a function
embed
函数已被删除,取而代之的是init
。将const-app
行上的javascript更改为:
const app = Elm.Hello.init({ node: myDiv });
const app = Elm.Hello.init({ node: myDiv });