script.js
javascript
(function() {const API_URL = 'http://localhost:8080/api/v1/matches';const matchesEl = document.getElementById('matches');function updateMatches() {fetch(API_URL).then(res => res.json()).then(data => {matchesEl.innerHTML = '';data.matches.forEach(match => {const newLi =match {border: 1px solid ccc;padding: 10px;width: 150px;text-align: center;
}.team-name {font-weight: bold;
}.score {font-size: 1.5em;
}HTML 說明標題:實時足球比分正文:一個 `ul` 列表,用于顯示實時比分數據。JavaScript 說明從 API 端點 `` 獲取實時比分數據。每隔 1000ms 更新一次比分數據。CSS 說明設置頁面樣式,包括字體、文本對齊、列表樣式等。定義 `match` 元素的樣式,使其顯示為一個邊框框,并包含球隊名稱和比分。