榆树新手在这里。
当我用以下CustomerSelect
模块替换下面Mpower
模块中的customers = ["Select Customer","Customer 1","Customer 2","Customer 3"]
customerSelect =
select [ ]
[ List.map customerItem customers
]
元素时
select
我收到Elm Compiler“Type Mismatch”错误:
函数
List VirtualDom.Node
期望第二个参数为:List (List Html)
但它是:
module Mpower where import Html exposing (..) import List exposing (..) customerItem custname = option [ ] [ text custname ] customerSelect = select [ ] [ customerItem "Select Customer", customerItem "Customer 1", customerItem "Customer 2", customerItem "Customer 3" ] view = div [] [ customerSelect ] main = view
这是从哪里来的?
#!/bin/bash
src=""
targ=${PWD}
while getopts "s:t:" opt; do
case $opt in
s)
src=$OPTARG
;;
t)
targ=$OPTARG
;;
esac
shift $((OPTIND-1))
done
echo "Source: $src"
echo "Target: $targ"
答案 0 :(得分:5)
List.map
已经返回一个列表,但你仍然在方括号中,所以它包含在另一个列表中。用括号括起来:
customers = ["Select Customer","Customer 1","Customer 2","Customer 3"]
customerSelect =
select [ ]
(List.map customerItem customers)