This commit is contained in:
rou
2026-03-23 14:56:04 +08:00
parent 00d3c9e4c6
commit 1071f4db05
27 changed files with 549 additions and 50 deletions

View File

@@ -12,3 +12,23 @@ function fakeFetchCourses() {
// 3. 调用 fakeFetchCourses()
// 4. 用 then 渲染课程列表
// 5. 用 catch 处理错误
const btn = document.getElementById("load-btn")
const text = document.getElementById("status-text")
const list = document.getElementById("course-list")
btn.addEventListener("click", function () {
text.textContent = "加载中..."
fakeFetchCourses()
.then(function (result) {
text.textContent = "加载成功"
const a = result.forEach(item => {
const li = document.createElement("li")
li.textContent = item
list.appendChild(li)
});
})
.catch(function (error) {
list.textContent = "失败" + error
})
})