修复在线音乐列表获取失败时无限循环请求的问题
This commit is contained in:
@@ -110,7 +110,8 @@ export default {
|
||||
})
|
||||
return list
|
||||
},
|
||||
search(str, page = 1, { limit } = {}) {
|
||||
search(str, page = 1, { limit } = {}, retryNum = 0) {
|
||||
if (++retryNum > 3) return Promise.reject(new Error('try max num'))
|
||||
if (limit != null) this.limit = limit
|
||||
// http://newlyric.kuwo.cn/newlyric.lrc?62355680
|
||||
return this.musicSearch(str, page).then(result => {
|
||||
@@ -118,7 +119,7 @@ export default {
|
||||
if (!result || result.success !== true) return Promise.reject(new Error(result ? result.info : '搜索失败'))
|
||||
let list = result.musics ? this.handleResult(result.musics) : []
|
||||
|
||||
if (list == null) return this.search(str, page, { limit })
|
||||
if (list == null) return this.search(str, page, { limit }, retryNum)
|
||||
|
||||
this.total = parseInt(result.pgt)
|
||||
this.page = page
|
||||
|
||||
Reference in New Issue
Block a user