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