天天看點

如何在Electron中使用jQuery

如果不做任何操作,在Electron中直接使用jquery會沒有效果或直接産生異常,解決方案如下:

将jquery.min.js檔案中最前的

! function(a, b) {
    "object" == typeof module && "object" == typeof module.exports ? module.exports = a.document ? b(a, !) : function(a) {
        if (!a.document) throw new Error("jQuery requires a window with a document");
        return b(a)
    } : b(a)
}
           

替換成

就闊以了。

繼續閱讀