如何在vue中引入jquery?

在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'

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *