Merge branch 'dev' of github.com:lyswhut/lx-music-desktop into dev

This commit is contained in:
lyswhut
2020-09-28 08:35:53 +08:00
5 changed files with 18 additions and 17 deletions
+2 -2
View File
@@ -94,7 +94,7 @@ export default {
})
}, 1000)
this.saveSearchHistoryList = throttle(n => {
rendererSend(NAMES.mainWindow.set_data, {
rendererSend(NAMES.mainWindow.save_data, {
path: 'searchHistoryList',
data: n,
})
@@ -292,7 +292,7 @@ export default {
rendererInvoke(NAMES.mainWindow.get_data, 'searchHistoryList').then(historyList => {
if (historyList == null) {
historyList = []
rendererInvoke(NAMES.mainWindow.set_data, { path: 'searchHistoryList', data: historyList })
rendererSend(NAMES.mainWindow.save_data, { path: 'searchHistoryList', data: historyList })
} else {
this.setSearchHistoryList(historyList)
}
+2 -2
View File
@@ -54,8 +54,8 @@ const actions = {
// mitations
const mutations = {
initList(state, { defaultList, loveList, userList }) {
if (defaultList != null) state.defaultList.list = defaultList.list
if (loveList != null) state.loveList.list = loveList.list
if (defaultList != null) Object.assign(state.defaultList, { list: defaultList.list, location: defaultList.location })
if (loveList != null) Object.assign(state.loveList, { list: loveList.list, location: loveList.location })
if (userList != null) state.userList = userList
allListInit(state.defaultList, state.loveList, state.userList)
state.isInitedList = true
+7 -8
View File
@@ -86,7 +86,6 @@ export default {
// isShowEditBtn: false,
isShowDownloadMultiple: false,
delayShow: false,
routeLeaveLocation: null,
isShowListAdd: false,
isShowListAddMultiple: false,
delayTimeout: null,
@@ -289,18 +288,14 @@ export default {
// },
beforeRouteLeave(to, from, next) {
this.clearDelayTimeout()
this.routeLeaveLocation = (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0
this.setListScroll({ id: this.listId, location: (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0 })
next()
},
created() {
this.listId = this.$route.query.id || this.defaultList.id
this.setPrevSelectListId(this.listId)
this.handleScroll = throttle(e => {
if (this.routeLeaveLocation) {
this.setListScroll({ id: this.listId, location: this.routeLeaveLocation })
} else {
this.setListScroll({ id: this.listId, location: e.target.scrollTop })
}
this.handleSaveScroll = throttle((listId, location) => {
this.setListScroll({ id: listId, location })
}, 1000)
this.listenEvent()
},
@@ -310,6 +305,7 @@ export default {
},
beforeDestroy() {
this.unlistenEvent()
this.setListScroll({ id: this.listId, location: (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0 })
},
methods: {
...mapMutations(['setPrevSelectListId']),
@@ -369,6 +365,9 @@ export default {
this.restoreScroll(this.$route.query.scrollIndex, false)
}
},
handleScroll(e) {
this.handleSaveScroll(this.listId, e.target.scrollTop)
},
clearDelayTimeout() {
if (this.delayTimeout) {
clearTimeout(this.delayTimeout)