[LayaNative 2.0]二次开发中:平台代码(android/ios)主动执行js脚本,在Laya1.0中生效,在Laya2.0中不生效
laya中代码:export default class Test {
public static onClick():void{
alert("123456");
}
public static onClick1():void{
}
}
原生中代码:ConchJNI.RunJS("Test.onClick()");
原生中报错:ReferenceError: Test is not defined
public static onClick():void{
alert("123456");
}
public static onClick1():void{
}
}
原生中代码:ConchJNI.RunJS("Test.onClick()");
原生中报错:ReferenceError: Test is not defined
1 个回复
helloworldlv
赞同来自:
public static onClick():void{
alert("123456");
}
public static onClick1():void{
}
}
if (window) {
(<any>window).Test = Test;
}
Test导到全局