在vue中引入jquery

来源:互联网 发布:音乐加快软件 编辑:程序博客网 时间:2024/05/22 17:32

在vue的项目中引入jquery:

1.安装jquery插件

npm install jquery --save

2.配置jquery插件

在webpack.dev.conf.js文件中配置plugins,如:

plugins: [    new webpack.ProvidePlugin({        jQuery: 'jquery',        $: 'jquery',        "window.jQuery": "jquery"    })]

3.在模块中使用时引入'$'符,就能使用jquery

import $ from 'jquery'


原创粉丝点击