添加源有效性校验
This commit is contained in:
@@ -30,6 +30,9 @@ const getters = {
|
||||
sources(state, getters, rootState, { sourceNames }) {
|
||||
return sources.map(item => ({ id: item.id, name: sourceNames[item.id] }))
|
||||
},
|
||||
sourceIds() {
|
||||
return sources.map(item => item.id)
|
||||
},
|
||||
boards(state) {
|
||||
return state.boards
|
||||
},
|
||||
|
||||
@@ -52,7 +52,7 @@ sources.forEach(source => {
|
||||
// getters
|
||||
const getters = {
|
||||
sourceInfo(state, getters, rootState, { sourceNames }) {
|
||||
return { sources: sources.map(item => ({ id: item.id, name: sourceNames[item.id] })), sortList }
|
||||
return { sourceIds: sources.map(item => item.id), sources: sources.map(item => ({ id: item.id, name: sourceNames[item.id] })), sortList }
|
||||
},
|
||||
tags: state => state.tags,
|
||||
isVisibleListDetail: state => state.isVisibleListDetail,
|
||||
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['setting']),
|
||||
...mapGetters('leaderboard', ['sources', 'boards', 'info']),
|
||||
...mapGetters('leaderboard', ['sources', 'sourceIds', 'boards', 'info']),
|
||||
boardList() {
|
||||
return this.source && this.boards[this.source] ? this.boards[this.source] : []
|
||||
},
|
||||
@@ -129,6 +129,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.source = this.setting.leaderboard.source
|
||||
if (!this.sourceIds.includes(this.source)) this.source = this.sourceIds[0]
|
||||
this.tabId = this.setting.leaderboard.tabId
|
||||
this.page = this.listInfo.page
|
||||
},
|
||||
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
case 'tx':
|
||||
case 'mg':
|
||||
case 'kg':
|
||||
case 'xm':
|
||||
// case 'xm':
|
||||
list.push({
|
||||
name: this.$t('songlist__open_list', { name: this.sourceInfo.sources.find(s => s.id == this.source).name }),
|
||||
id: 'importSongList',
|
||||
@@ -164,6 +164,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.source = this.setting.songList.source
|
||||
if (!this.sourceInfo.sourceIds.includes(this.source)) this.source = this.sourceInfo.sourceIds[0]
|
||||
this.isToggleSource = true
|
||||
this.tagInfo = this.setting.songList.tagInfo
|
||||
this.sortId = this.setting.songList.sortId
|
||||
|
||||
Reference in New Issue
Block a user