1. 停掉vue服务

2. 使用npm下载jquery

npm install jquery --save

3. 在项目的main.js页面引入

import jquery from "jquery";

4. 在项目的vue.config.js页面引入


module.exports = defineConfig({
  configureWebpack: {
    plugins: [
      new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery",
        "windows.jQuery": "jquery",
      }),
    ],
  },

  ...其他代码
});

5. 重新启动vue服务,即可!

Logo

前往低代码交流专区

更多推荐