我创建了一个全新的项目(rails 6.0.2.2)。现在面临一个问题
testing.js:2 Uncaught TypeError: $(...).slick is not a function
整合完成后
我整合光滑轮播的方式是:
app/javascript/packs/application.js
中
config/webpack/environment.js
environment.plugins.prepend('Provide',
new webpack.ProvidePlugin({
$: 'jquery/src/jquery',
jQuery: 'jquery/src/jquery'
})
)
源同时具有jquery和slick-carousel,但是$('.testing').slick()
给了我上面的错误
package.json
"dependencies": {
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "4.2.2",
"bootstrap": "^4.4.1",
"jquery": "^3.5.0",
"slick-carousel": "^1.8.1",
"turbolinks": "^5.2.0"
},