總結一些 egret項目接小程序時 遇到的問題及解決方法


1,https://blog.csdn.net/u013052238/article/details/81456908  這個地址的一些問題 是一部分,

其中 第6條,當在wxgame.ts中仿照已有的 暴露庫給window的方法寫完之后,仍會報錯,本人遇到的是 : jszip is not defined :  

也嘗試過其他前輩分享的解決方法:如 將jszip.min.js 的開頭部分 :

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof __global?e=__global:"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.JSZip=t()}}

中帶背景顏色的代碼段替換成 window.JSZip = =t();  但是並未有效果;

最后行之有效的解決方法是 :在 jszip.js 中的開頭部分:

 

!function (a) { if ("object" == typeof exports && "undefined" != typeof module){
module.exports = a();

添加上一句:window.JSZip = a();  變成 :

!function (a) { if ("object" == typeof exports && "undefined" != typeof module){
  window.JSZip = a();
  module.exports = a();
}

或者可以嘗試,在 wxgame.ts 中,添加jszip的時候 ,content寫成如下:

 2, 

 

解決方式如下:

 

2,還有類似  createElementNS 不存在的 錯誤:

可以參照這里createElementNS("","") 改成 createElement ("")的解決方法,地址如下:

 https://blog.csdn.net/weixin_36065510/article/details/79115771

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM