如何使用单个按钮 ia 钛合金视图将多个值传递给函数?
我的按钮在 view.xml 中如下所示:
<Button id="star4" onClick="vote1('value1', 'value2')" />
控制器.js
function vote1 (val1, val2) {
console.log(val1 + val2 + "this is val1 and val2");
现在控制台显示正确的值“val1”和“val2”(见[INFO]),但也有一个红色的错误屏幕抱怨传递给函数的类型无效:
[ERROR] : Script Error {
[ERROR] : backtrace = "#0 () at
...
[ERROR] : line = 395;
[ERROR] : message = "Invalid type passed to function";
**[INFO] : value1value2this is val1 and val2**
[ERROR] : nativeLocation = "-[TiProxy addEventListener:] (TiProxy.m:824)";
[ERROR] : nativeReason = "expected: Function, was: NSNull";
...
[ERROR] : }
}