使用默认参数:
var p6 = new Progress(); p6.init({ mountedId: '#bar6' });
单独传参:
var config5 = { mountedId: '#bar5', target: 8, step: 1, color: 'green', fontSize: "20px", borderRadius: "5px", backgroundColor: '#eee', barBackgroundColor: 'red', }; var p5 = new Progress(); p5.init(config5);
批量:
for (let i = 1; i < 5; i++) { var config = { mountedId: '#bar' + i, target: (i + 5) * 10, step: i, color: 'red', fontSize: 20 + i + "px", borderRadius: i + 5 + 'px', backgroundColor: '#eee', barBackgroundColor: '#' + "f" + i + i, }; var p = new Progress(); p.init(config); }