ionrangeSlider Nuxt Vue

时间:2020-04-28 08:25:49

标签: vue.js nuxt.js ion-range-slider

我是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正确编译库,但是我不知道该怎么办:(

0 个答案:

没有答案