直接return false没用,需要用throw来跳出foreach
1 try {
2 this.categoryList.forEach((item, index) => {
3 if (item.title !== '') {
4 data = {
5 page: item.xxx,
6 state: item.xxx,
7 }
8 throw new Error('')
9 }
10 })
11 } catch (e) {
12 this.getList(data)
13 return false
14 }