noUiSlider 前缀未正确更新
noUiSlider prefix is not updating correctly
所以我使用 noUiSlider 来选择价格。句柄值有一个货币前缀,所以如果客户更改货币,我自然需要更新它。
这是我的代码:
priceSlider.noUiSlider.updateOptions({
range: {
min: minPrice,
max: maxPrice
},
format: wNumb({ decimals: 0, prefix: currency })
})
奇怪的是,范围正在正常更新,但前缀没有正确更新。我还需要做些什么才能做到这一点吗?
我是这样完成的:
// Old prefix is different to new prefix, must destroy slider entirely
if ((priceSlider.noUiSlider.get()).charAt(0) != currency) {
priceSlider.noUiSlider.destroy()
// Create new slider here
} else {
// Old prefix is identical, just do a regular update
coursePriceSlider.noUiSlider.updateOptions({
// options here
})
}
所以我使用 noUiSlider 来选择价格。句柄值有一个货币前缀,所以如果客户更改货币,我自然需要更新它。
这是我的代码:
priceSlider.noUiSlider.updateOptions({
range: {
min: minPrice,
max: maxPrice
},
format: wNumb({ decimals: 0, prefix: currency })
})
奇怪的是,范围正在正常更新,但前缀没有正确更新。我还需要做些什么才能做到这一点吗?
我是这样完成的:
// Old prefix is different to new prefix, must destroy slider entirely
if ((priceSlider.noUiSlider.get()).charAt(0) != currency) {
priceSlider.noUiSlider.destroy()
// Create new slider here
} else {
// Old prefix is identical, just do a regular update
coursePriceSlider.noUiSlider.updateOptions({
// options here
})
}