-
Creator 版本: 3.5.1
-
目标平台: Google chrome浏览器
-
重现方式:
-
首个报错:
-
之前哪个版本是正常的:
-
手机型号:
-
手机浏览器:
-
编辑器操作系统:
-
重现概率:
在assets同级目录下新建global.d.ts文件。
声明变量
declare let net_path_name_login_text:string;
在StarGame.ts文件的start()中对变量赋值net_path_name_login_text = “10”;
Cocos creator没有报错,但是浏览器一运行就报错
ReferenceError: net_path_name_login_text is not defined
at StarGame.start (StarGame.ts:91:33)
at component-scheduler.ts:261:22
at OneOffInvoker._invoke (component-scheduler.ts:228:13)
at OneOffInvoker.invoke (component-scheduler.ts:143:14)
at ComponentScheduler.startPhase (component-scheduler.ts:455:27)
at Director.tick (director.ts:694:37)
at callback (game.ts:838:26)
请问这是什么原因,需要导入.d.ts文件吗,在哪导入?