如何再nodejs中使用jquery
安装相关依赖
npm install jquery
npm install jsdom
引入方式
const jsdom = require('jsdom');
const {JSDOM} = jsdom;
const {document} = (new JSDOM('<!doctype html><html><body></body></html>')).window;
global.document = document;
const window = document.defaultView;
const $ = require('jquery')(window);
评论已关闭