第二个 While 循环返回一个实例

问题描述

下面的代码只是我整个代码一个片段,我遇到的问题是第一个 while 循环返回所有实例,但第二个 while 循环只返回一个实例。我试过把它们放在不同的功能中,但这没有帮助,有人可以帮忙吗?

    function refreshCurveData() {
    selectedDate = document.querySelectorAll(".buyclass .column-date.sorting_1")[1].textContent;
    buyPriceTable = document.querySelectorAll(".buyclass td.column-price");
    buyVolTable = document.querySelectorAll(".buyclass td.column-volume");

    sellPriceTable = document.querySelectorAll(".sellclass td.column-price");
    sellVolTable = document.querySelectorAll(".sellclass td.column-volume");

    let i = 0;
    do {
        var buyPriceData1 = buyPriceTable[i].textContent;
        var buyVolData1 = buyVolTable[i].textContent;

        buyPriceData[i] = {
            x: parseFloat(buyPriceData1.replace(/\,/g,'')),y: parseFloat(buyVolData1.replace(/\,''))
        };
        i++;
    }        
    while (document.querySelectorAll(".buyclass .column-date.sorting_1")[i].textContent === selectedDate);

    let j = 0;
    do {    
        var sellPriceData1 = sellPriceTable[j].textContent;
        var sellVolData1 = sellVolTable[j].textContent;

        sellPriceData[j] = {
            x: parseFloat(sellPriceData1.replace(/\,y: parseFloat(sellVolData1.replace(/\,''))
        };

        j++;
    }
    while (document.querySelectorAll(".sellclass .column-date.sorting_1")[j].textContent === selectedDate);
}

setInterval(() => {
    refreshCurveData();
    scatterChart.update();

},2500);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)