一个元素没问题,但是这里抛出错误“el.roundSlider 不是函数”,Jquery 在主 js 文件之前连接,与 Jquery .each 相同
const scArr = Array.from($('.slider'));
scArr.forEach(el => el.roundSlider({
radius: 80,
circleShape: "half-left",
sliderType: "min-range",
showTooltip: false,
value: 150,
width: 10,
min: 0,
max: 200
}));
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/roundSlider/1.6.1/roundslider.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/roundSlider/1.6.1/roundslider.css" integrity="sha512-XO53CaiPx+m4HUiZ02P4OEGLyyT46mJQzWhwqYsdqRR7IOjPuujK0UPAK9ckSfcJE4ED7dT9pF9r78yXoOKeYw==" crossorigin="anonymous" />
<div class="slider"></div>
<div class="slider"></div>
<div class="slider"></div>