【发布时间】:2019-01-10 19:35:21
【问题描述】:
我有一个 index.html,其中包含我的 Elm 应用程序。 Elm 应用程序使用各种 GETs 到一个 API,该 API 由与 index.html 提供服务的服务器相同。
而不是在我的 Elm 代码中为 GETs 硬编码 URL,例如:
url =
"http://localhost:8080/api/tasks"
有没有返回window.location.href值的函数?
我想做这样的事情:
url =
getHref() ++ "/api/tasks"
这样,如果我将服务器移动到其他地方,我就不需要更新 Elm 代码中的所有 url。
【问题讨论】:
标签: elm location-href