vue2
This commit is contained in:
@@ -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}`);
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user