[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
 
已邀请:

helloworldlv

赞同来自:

export default class Test { 
public static onClick():void{ 
alert("123456");

public static onClick1():void{ 
 
}

if (window) {
(<any>window).Test = Test;
}
Test导到全局

该问题目前已经被锁定, 无法添加新回复

商务合作
商务合作