检索title字段,是否包含检索关键字
recursiveFn(data, val) { let { hasProp } = this let arr = [] data.map(item => { if (item.children) { let children = item.children item.children = this.recursiveFn(children, val) if (hasProp(item.title, val) || (item.children && item.children.length > 0)) { arr.push(item) } } else { if (hasProp(item.title, val)) { arr.push(item) } } }) return arr }, hasProp(string, prop) { return string.indexOf(prop) > -1 },