没有提到这个here .
当我尝试时,它说 Module Platform does not expose Sub
最佳答案
Platform.Sub
和 Platform.Cmd
是imported by default 作为 Sub
和 Cmd
, 所以你需要省略 Platform.
-部分。
还值得注意的是 Platform
, Platform.Sub
, 和 Platform.Cmd
都是不同的模块,也就是说,如果它们不是默认导入的,而你只是导入了 Platform
,您仍然无法访问 Sub
和 Cmd
与 Platform.
字首。如果您查看 source,这一点会更加明显。对于核心包(特别是 Platform.elm
和 Platform/
)。
关于elm - 如果我想使用 Platform.Sub.map,是否必须导入它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43371758/