SOURCE

let data = [];
for(let i=0; i<199; i++) {
    data.push({
        id: String(i)
    })
};

function queryData({page, limit}){
    return new Promise((resolve, reject) => {
        try {
            let start = (page - 1) * limit + 1;
            let end = page * limit;
            let res = data.slice(start, end);
            resolve(res);
        }
        catch(err) {
            reject(err)
        }
    })
    
}

let page = 1, limit = 10, list = [];
function getList() {
    let formData = {
        page,
        limit
    }
    queryData(formData)
    .then(res => {
        let resFilterList = res.filter(item => {
            return item.id.indexOf('9') != -1
        });
        list = [...list, ...resFilterList];
        console.log('list -> ', list)
        if(list.length < 10) {
            page += 1;
            getList();
        }
    })
    .catch(err => {
        console.log('err -> ', err)
    })
}

window.onload = function() {
    getList()
}
console 命令行工具 X clear

                    
>
console