一只陌生人
2021-12-27 22:05
采纳率: 91.5%
浏览 33

vue里面怎么使用String字符串操作的includes

报错:

img


代码:

searchCourse:(data)=>{
            if (data.length !== 0) {
                for (let i = 0;i < data.length;i++) {
                    let titleState = data[i].videoTitle.includes(this.searchKey);
                    let conState = data[i].videoInfo.includes(this.searchKey);
                    if (titleState){
                        if (this.videoSearchResultArr.length !== 0) {
                            for (let v = 0;v < vm.videoSearchResultArr.length;v++) {
                                if (data[i].videoTitle !== vm.videoSearchResultArr[v].videoTitle && data[i].videoInfo !== vm.videoSearchResultArr[v].videoInfo) {
                                    vm.videoSearchResultArr.push(data[i]);
                                }
                            }
                        }else {
                            vm.videoSearchResultArr.push(data[i]);
                        }
                    }
                    if (conState) {
                        if (this.videoSearchResultArr.length !== 0) {
                            for (let v = 0;v < vm.videoSearchResultArr.length;v++) {
                                if (data[i].videoTitle !== vm.videoSearchResultArr[v].videoTitle && data[i].videoInfo !== vm.videoSearchResultArr[v].videoInfo) {
                                    vm.videoSearchResultArr.push(data[i]);
                                }
                            }
                        }else {
                            vm.videoSearchResultArr.push(data[i]);
                        }
                    }
                }
            }
        }

不知道为什么一直用不了这个关键字,原生js是没问题的,但一搭载vue框架就当机了

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

相关推荐 更多相似问题