原先用jquery做的,現在整合webpack+vue
其實只需要webpack就行了,只是爲了方便打包。
1、關閉eslint 檢測,如果開啓,插件裏面全是報錯,麻煩的很。
webpack.base.conf.js
const createLintingRule = () => ({
//刪除這裏面的代碼
})
2、安裝並引入jquery 這裏大小寫都要引入
npm install [email protected] --save-dev
plugins: [
new webpack.optimize.CommonsChunkPlugin('common.js'),
new webpack.ProvidePlugin({
jquery: 'jquery',
jQuery: 'jquery',
$: 'jquery'
})
],
3、在視圖頁面 引入 jqueryRotate
import $ from 'jquery'
import '../assets/js/jQueryRotate.2.2.js'
大功告成