// -------------------------------------------------- const caseCounter = document.getElementById('case-counter'); const caseCounter2 = document.getElementById('case-counter2'); let response = []; // { col:6,eventType: '類型4', todayCount: 5, lastUpdate: '2023-06-07' }, function drawCounter(data) { // 清空 DOM caseCounter.innerHTML = ''; caseCounter2.innerHTML = ''; // 重新繪製 DOM response = data; response.forEach((eventInfo, index) => { const card = `
${eventInfo.eventType}

${eventInfo.todayCount} 件


上次更新: ${eventInfo.lastUpdate}

`; const card2 = `
${eventInfo.eventType}

${eventInfo.todayCount} 件


上次更新: ${eventInfo.lastUpdate}

`; if (index < 6) { caseCounter.insertAdjacentHTML('beforeend', card); } else { caseCounter2.insertAdjacentHTML('beforeend', card2); } }); } // --------------------------------------------------