setFilter()
描述
在当前活动项目中按指定条件筛选任务
用法
setFilter({
match: string | null,
by?: string,
highlight?: boolean,
strict?: boolean
}): void;
参数
match- (必填)匹配模式by- (可选)task对象中用于搜索的参数;默认为 texthighlight- (可选)定义是否高亮显示匹配结果strict- (可选)启用严格筛选模式,搜索将按精确匹配执行
信息
若要重置筛选,请向该方法传入 match: null
示例
const { ToDo, Toolbar } = todo;
const { tasks, users, projects, tags } = getData();
// 创建 To do list
const list = new ToDo("#root", {
tasks,
users,
projects,
tags,
});
// 按指定规则筛选数据
list.setFilter({
match: "ran",
highlight: true
});
// 重置筛选
list.setFilter({ match: null });
相关文章: 任务排序与筛选