简体   繁体   English

如何更改滑块(材质 ui)中标签的值?

[英]how to change the value of label in slider (material ui)?

code sample: https://codesandbox.io/s/runtime-worker-kxse3?file=/src/App.js代码示例: https : //codesandbox.io/s/runtime-worker-kxse3?file=/src/App.js

i want the labels in bubble to show the same value as text(3,5,7,10)我希望气泡中的标签显示与文本相同的值(3,5,7,10)

Return the label instead of index on your valueLabelFormat .valueLabelFormat上返回label而不是index Change it to将其更改为

function valueLabelFormat(value) {
  return marks.find((mark) => mark.value === value).label;
}

编辑interesting-kalam-5vq67

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM