1: npm i jquery

2: webpack.base.conf.js文件中,加入(没标红的这一段, new webpack.ProvidePlugin...)

resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      'vue$': 'vue/dist/vue.esm.js',
      '@': resolve('src')
    }
  },
  plugins: [
     new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery"
     })
  ],
  module: {

3:import $ from 'jquery'

4:愉快的使用

  end 

相关文章:

  • 2021-04-29
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2021-12-26
  • 2022-12-23
  • 2021-10-19
猜你喜欢
  • 2022-12-23
  • 2021-06-04
  • 2021-05-30
  • 2021-09-22
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案