From e3a0830c901b4bda9ec3a5bf3b24782c5a682b1c Mon Sep 17 00:00:00 2001 From: Antkites Date: Mon, 12 Aug 2024 22:50:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=5F=5FwxConfig?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/unpack/ujs.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/unpack/ujs.go b/internal/unpack/ujs.go index 86f07bc..70de4c9 100644 --- a/internal/unpack/ujs.go +++ b/internal/unpack/ujs.go @@ -67,7 +67,8 @@ func (p *JavaScriptParser) Parse(option config.WxapkgInfo) error { } // 防止报错 - patch := `var window={};var navigator={};navigator.userAgent="iPhone";window.screen={};document={};function require(){};` + patch := `var window={};var navigator={};navigator.userAgent="iPhone";window.screen={}; +document={getElementsByTagName:()=>{}};function require(){};` scriptcode := patch + string(code) @@ -114,12 +115,12 @@ func (p *JavaScriptParser) Parse(option config.WxapkgInfo) error { // return err //} // - //// 提供 __wxConfig 变量的默认实现 - //err = vm.Set("__wxConfig", make(map[string]interface{})) - //if err != nil { - // return err - //} - // + // 提供 __wxConfig 变量的默认实现 + err = vm.Set("__wxConfig", make(map[string]interface{})) + if err != nil { + return err + } + //// 提供 global 变量的默认实现 //err = vm.Set("global", make(map[string]interface{})) //if err != nil {