加载新列表时清空当前列表

This commit is contained in:
lyswhut
2020-02-15 18:07:12 +08:00
parent ecdcb040ee
commit d557149326
4 changed files with 15 additions and 6 deletions
@@ -39,6 +39,7 @@ const actions = {
let tabId = rootState.setting.leaderboard.tabId
let key = `${source}${tabId}${page}}`
if (state.list.length && state.key == key) return true
commit('clearList')
return music[source].leaderboard.getList(tabId, page).then(result => commit('setList', { result, key }))
},
}
@@ -52,6 +53,10 @@ const mutations = {
state.page = result.page
state.key = key
},
clearList(state) {
state.list = []
state.total = 0
},
}
export default {