把你的worker.js文件放到一个js目录下,譬如引擎的js类是再libs下,你可以可以吧worker.js放到libs下,同时再index.html下通过script标签引用下,具体引用位置index.html下有注释告诉,然后代码里写:
Laya.WorkerLoader.workerPath = "libs/worker.js";
Laya.WorkerLoader.enable = true;
就可以了
如果是as写的代码,也是一样的,把worker.js放到h5目录下,同时再index.html下通过script标签引用下,具体引用位置index.html下有注释告诉,然后代码里写
WorkerLoader.workerPath = "worker.js所在路径";
WorkerLoader.enable = true;