How to use jquery under the Electron framework?

When developing a desktop application based on the Electron framework, if jquery is used, there will be a conflict: jQuery is not defined.

There are several solutions, the following method is to avoid the conflict by modifying the jquery file:

Open jquery.js and add at the beginning of the file:

if (typeof module === 'object') {window.module = module; module = undefined;}

At the end of the file add:

if (window.module) module = window.module;

In this way, there will be no problem of not finding $.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325248315&siteId=291194637