修复问题

This commit is contained in:
lyswhut
2021-12-04 17:25:21 +08:00
parent 9afafec9d6
commit 60e606a413
13 changed files with 62 additions and 83 deletions
@@ -1,4 +1,4 @@
import { useRoute, useRouter, onMounted, onBeforeUnmount, nextTick, watch } from '@renderer/utils/vueTools'
import { useRoute, useRouter, onMounted, onBeforeUnmount } from '@renderer/utils/vueTools'
import { setListPosition, getListPosition } from '@renderer/utils/data'
export default ({ props, listRef, list, setting }) => {
@@ -27,21 +27,6 @@ export default ({ props, listRef, list, setting }) => {
handleScrollList(index, isAnimation)
}
watch(() => route.query.id, (id, oId) => {
if (!oId || route.path != '/list') return
const scrollIndex = route.query.scrollIndex
nextTick(() => {
restoreScroll(scrollIndex, false)
if (scrollIndex != null) {
router.replace({
path: 'list',
query: {
id: props.listId,
},
})
}
})
})
onMounted(() => {
restoreScroll(route.query.scrollIndex, false)
if (route.query.scrollIndex != null) {
@@ -49,6 +34,7 @@ export default ({ props, listRef, list, setting }) => {
path: 'list',
query: {
id: props.listId,
updated: true,
},
})
}
+10 -2
View File
@@ -160,6 +160,9 @@ export default {
created() {
this.setPrevSelectListId(this.listId)
},
mounted() {
this.setListsScroll()
},
methods: {
...mapMutations('list', [
'setUserListName',
@@ -174,6 +177,13 @@ export default {
...mapActions('leaderboard', {
getBoardListAll: 'getListAll',
}),
setListsScroll() {
let target = this.$refs.dom_lists_list.querySelector('.' + this.$style.active)
if (!target) return
let offsetTop = target.offsetTop
let location = offsetTop - 150
if (location > 0) this.$refs.dom_lists_list.scrollTop = location
},
handleListsSave(index, event) {
let dom_target = this.$refs.dom_lists_list.querySelector('.' + this.$style.editing)
if (dom_target) dom_target.classList.remove(this.$style.editing)
@@ -351,8 +361,6 @@ export default {
})
},
handleImportList(index) {
const list = this.getTargetListInfo(index)
selectDir({
title: this.$t('lists__import_part_desc'),
properties: ['openFile'],