【发布时间】:2017-11-04 15:59:28
【问题描述】:
我正在尝试在我的反应应用程序中使用 ion-rangeslider。但它没有在网页上显示 ui。我正在像这样初始化它的 componentDidMount 方法
componentDidMount = () => {
$("#ionSlider-newTag").ionRangeSlider({
min: 0,
max: 5000,
type: 'double',
postfix: 's',
maxPostfix: "+",
prettify: false,
hasGrid: true,
from: 1600,
to: 2950
});
我也尝试过不使用 jquery 进行初始化
var slider = document.getElementById('ionSlider-newTag');
ionRangeSlider.create(slider,{
min: 0,
max: 5000,
type: 'double',
postfix: 's',
maxPostfix: "+",
prettify: false,
hasGrid: true,
from: 1600,
to: 2950
});
但它给了我错误提示
Uncaught TypeError: _ionRangeslider2.default.create is not a function
我使用 create 来初始化 noUiSlider,它在那里工作。但是 create 不适用于 ionrangeslider。
我该如何解决这个完整的问题?
【问题讨论】:
-
看起来您在第一次尝试时错过了 CSS
-
我应该如何包含?
-
我已经下载了 ionslider 的 npm 包
标签: jquery reactjs jquery-plugins nouislider ion-range-slider