已解决!!!
[JavaScript] 纯文本查看 复制代码 function runVM(name, code) {
let wxAppCode = {};
let handle = { cssFile: name };
let gg = new GwxCfg();
let tsandbox = {
$gwx: GwxCfg.prototype["$gwx"],
__mainPageFrameReady__: GwxCfg.prototype["$gwx"],
__vd_version_info__: GwxCfg.prototype["$gwx"],
__wxAppCode__: wxAppCode,
setCssToHead: cssRebuild.bind(handle)
}
let vm = new VM({ sandbox: tsandbox });
vm.run(code);
for (let name in wxAppCode) {
if (name.endsWith(".wxss")) {
handle.cssFile = path.resolve(frameName, "..", name);
wxAppCode[name]();
}
}
} |