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: default:
entry.value = input.value; entry.value = input.value;
} }
switch (dataType) { if (entry.value != null) {
case "integer": switch (dataType) {
entry.value = parseInt(entry.value); case "integer":
break; entry.value = parseInt(entry.value);
case "float": break;
entry.value = parseFloat(entry.value); case "float":
break; entry.value = parseFloat(entry.value);
case "bool": break;
entry.value = (entry.value === "true") || (entry.value === "1"); case "bool":
break; entry.value = (entry.value === "true") || (entry.value === "1");
break;
}
} }
return entry; 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; entry.value = input.value;
} }
switch (dataType) { if (entry.value != null) {
case "integer": switch (dataType) {
entry.value = parseInt(entry.value); case "integer":
break; entry.value = parseInt(entry.value);
case "float": break;
entry.value = parseFloat(entry.value); case "float":
break; entry.value = parseFloat(entry.value);
case "bool": break;
entry.value = (entry.value === "true") || (entry.value === "1"); case "bool":
break; entry.value = (entry.value === "true") || (entry.value === "1");
break;
}
} }
return entry; return entry;
} }

View File

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