我能够从alloy.js类文件中调用变量和函数,但是我想从alloy.js of index.js调用一个方法。怎么做呢?我试图删除require(index.js或index),但是没有成功,它弹出一个错误并使应用程序崩溃。
index.js
todo_method{
}
alloy.js
//call todo_method(); of index.js发布于 2014-10-12 16:48:23
以下是您可以这样做的方法:
index.js
$.sayHello = function() { // Or you can use `exports.sayHello` too
console.log("Hello");
};alloy.js
var index = Alloy.createController("index");
index.sayHello(); // Call function defined in index.jshttps://stackoverflow.com/questions/26326226
复制相似问题