This commit is contained in:
rou
2026-03-26 21:45:32 +08:00
parent 7c0cbe1320
commit 2a65ba8c6a
7 changed files with 169 additions and 59 deletions

View File

@@ -52,15 +52,23 @@ new Vue({
computed: {
filteredCourses() {
// 任务:根据 keyword 过滤课程列表
return this.courses;
let value = this.keyword.trim().toUpperCase()
return this.courses.filter(item => item.title.toUpperCase().includes(value))
},
},
methods: {
toggleCourse(courseId) {
// 任务:根据 courseId 切换 finished
const a = this.courses.find(item => {
if (item.id === courseId) {
item.finished = !item.finished
}
return;
})
},
focusInput() {
// 任务:通过 ref 聚焦输入框
this.$refs.keywordInput.focus()
},
},
});