Fix bug of Form component

This commit is contained in:
cuigh 2017-11-23 16:00:07 +08:00
parent 317446e5cd
commit 8ce6adf478
4 changed files with 25 additions and 24 deletions

View File

@ -747,16 +747,18 @@ var Swirl;
default:
entry.value = input.value;
}
switch (dataType) {
case "integer":
entry.value = parseInt(entry.value);
break;
case "float":
entry.value = parseFloat(entry.value);
break;
case "bool":
entry.value = (entry.value === "true") || (entry.value === "1");
break;
if (entry.value != null) {
switch (dataType) {
case "integer":
entry.value = parseInt(entry.value);
break;
case "float":
entry.value = parseFloat(entry.value);
break;
case "bool":
entry.value = (entry.value === "true") || (entry.value === "1");
break;
}
}
return entry;
}

File diff suppressed because one or more lines are too long

View File

@ -233,16 +233,18 @@ namespace Swirl.Core {
entry.value = input.value;
}
switch (dataType) {
case "integer":
entry.value = parseInt(entry.value);
break;
case "float":
entry.value = parseFloat(entry.value);
break;
case "bool":
entry.value = (entry.value === "true") || (entry.value === "1");
break;
if (entry.value != null) {
switch (dataType) {
case "integer":
entry.value = parseInt(entry.value);
break;
case "float":
entry.value = parseFloat(entry.value);
break;
case "bool":
entry.value = (entry.value === "true") || (entry.value === "1");
break;
}
}
return entry;
}

View File

@ -16,9 +16,6 @@ var Funcs = map[string]interface{}{
// return t.Local().Format("2006-01-02 15:04:05")
//},
"join": strings.Join,
"eq": func(v1, v2 interface{}) bool {
return fmt.Sprint(v1) == fmt.Sprint(v2)
},
"elem": func(i interface{}) interface{} {
v := reflect.ValueOf(i)
for v.Kind() == reflect.Ptr {