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

@@ -11,16 +11,19 @@ new Vue({
computed: {
filteredCourses() {
// 任务:返回过滤后的课程列表
return this.courses;
const value = this.keyword.trim().toUpperCase()
return this.courses.filter(item => item.title.toUpperCase().includes(value))
},
matchedCount() {
// 任务:返回 filteredCourses 的数量
return 0;
return this.filteredCourses.length;
},
},
watch: {
keyword(newValue) {
// 任务:在控制台输出关键字变化
console.log(`筛选关键词:${newValue}`);
},
},
});