js 判断字符串是否包含另外一个字符串(两种方法) 方法一 //indexOf方法来确定字符串中是否包含了另一个字符串: var str = "hello world" let val = str.indexOf("w")==-1?false:true 方法二 //includes() 返回bool值,表示是否找到参数字符串 this.dataSource.filter(item=>item.serviceName.includes(this.searchText))