我是Nuxt的新手,正在尝试使用一个jQuery库“ ionrangeSlider”,但出现错误:
$(...).ionRangeSlider is not a function
我运行了npm i ion-rangeslider
,然后在nuxt.config.js中添加了供应商:
build: {
vendor: [
"jquery",
"ion-rangeslider"
],
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
})
],
},
在我的组件中,我有:
mounted(){
var that = this;
this.$nextTick(function(){
$(that.$refs.range).ionRangeSlider();
},
}
我认为nuxt不能从node_modules正确编译库,但是我不知道该怎么办:(