修复列表项高度随窗口的大小适配问题
parent
7de91bd923
commit
a1935cbdac
|
@ -14,7 +14,7 @@ div(:class="$style.songList")
|
||||||
th.nobreak(:style="{ width: rowWidth.r6 }") {{$t('material.song_list.action')}}
|
th.nobreak(:style="{ width: rowWidth.r6 }") {{$t('material.song_list.action')}}
|
||||||
div(:class="$style.content")
|
div(:class="$style.content")
|
||||||
div(v-if="list.length" :class="$style.content" ref="dom_listContent")
|
div(v-if="list.length" :class="$style.content" ref="dom_listContent")
|
||||||
material-virtualized-list(:list="list" key-name="songmid" ref="list" :item-height="37"
|
material-virtualized-list(:list="list" key-name="songmid" ref="list" :item-height="listItemHeight"
|
||||||
containerClass="scroll" contentClass="list" @contextmenu.native.capture="handleContextMenu")
|
containerClass="scroll" contentClass="list" @contextmenu.native.capture="handleContextMenu")
|
||||||
template(#default="{ item, index }")
|
template(#default="{ item, index }")
|
||||||
div.list-item(@click="handleDoubleClick($event, index)" @contextmenu="handleListItemRigthClick($event, index)"
|
div.list-item(@click="handleDoubleClick($event, index)" @contextmenu="handleListItemRigthClick($event, index)"
|
||||||
|
@ -72,6 +72,7 @@ div(:class="$style.songList")
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import { scrollTo, clipboardWriteText, assertApiSupport } from '../../utils'
|
import { scrollTo, clipboardWriteText, assertApiSupport } from '../../utils'
|
||||||
import musicSdk from '../../utils/music'
|
import musicSdk from '../../utils/music'
|
||||||
|
import { windowSizeList } from '@common/config'
|
||||||
export default {
|
export default {
|
||||||
name: 'MaterialSongList',
|
name: 'MaterialSongList',
|
||||||
model: {
|
model: {
|
||||||
|
@ -162,6 +163,9 @@ export default {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
listItemHeight() {
|
||||||
|
return parseInt(windowSizeList.find(item => item.id == this.setting.windowSizeId).fontSize) / 16 * 37
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// selectdList(n) {
|
// selectdList(n) {
|
||||||
|
|
|
@ -178,7 +178,7 @@ export default {
|
||||||
// console.log(continuous)
|
// console.log(continuous)
|
||||||
// debugger
|
// debugger
|
||||||
if (continuous) {
|
if (continuous) {
|
||||||
if (Math.abs(currentScrollTop - this.scrollTop) < this.itemHeight * 5) return
|
if (Math.abs(currentScrollTop - this.scrollTop) < this.itemHeight * this.outsideNum * 0.6) return
|
||||||
// console.log('update')
|
// console.log('update')
|
||||||
if (currentScrollTop > this.scrollTop) { // scroll down
|
if (currentScrollTop > this.scrollTop) { // scroll down
|
||||||
// console.log('scroll down')
|
// console.log('scroll down')
|
||||||
|
|
|
@ -15,7 +15,7 @@ div(:class="$style.download")
|
||||||
th.nobreak(style="width: 10%;") {{$t('view.download.quality')}}
|
th.nobreak(style="width: 10%;") {{$t('view.download.quality')}}
|
||||||
th.nobreak(style="width: 13%;") {{$t('view.download.action')}}
|
th.nobreak(style="width: 13%;") {{$t('view.download.action')}}
|
||||||
div(v-if="list.length" :class="$style.content" ref="dom_listContent")
|
div(v-if="list.length" :class="$style.content" ref="dom_listContent")
|
||||||
material-virtualized-list(:list="showList" key-name="key" ref="list" :item-height="37" #default="{ item, index }"
|
material-virtualized-list(:list="showList" key-name="key" ref="list" :item-height="listItemHeight" #default="{ item, index }"
|
||||||
containerClass="scroll" contentClass="list")
|
containerClass="scroll" contentClass="list")
|
||||||
div.list-item(@click="handleDoubleClick($event, index)" @contextmenu="handleListItemRigthClick($event, index)"
|
div.list-item(@click="handleDoubleClick($event, index)" @contextmenu="handleListItemRigthClick($event, index)"
|
||||||
:class="[{[$style.active]: playListIndex == index }, { selected: selectedIndex == index }, { active: selectedData.includes(item) }]")
|
:class="[{[$style.active]: playListIndex == index }, { selected: selectedIndex == index }, { active: selectedData.includes(item) }]")
|
||||||
|
@ -39,6 +39,7 @@ import { mapGetters, mapActions, mapMutations } from 'vuex'
|
||||||
import { checkPath, openDirInExplorer, openUrl } from '../utils'
|
import { checkPath, openDirInExplorer, openUrl } from '../utils'
|
||||||
import musicSdk from '../utils/music'
|
import musicSdk from '../utils/music'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { windowSizeList } from '@common/config'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Download',
|
name: 'Download',
|
||||||
|
@ -171,6 +172,9 @@ export default {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
listItemHeight() {
|
||||||
|
return parseInt(windowSizeList.find(item => item.id == this.setting.windowSizeId).fontSize) / 16 * 37
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
list() {
|
list() {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
th.nobreak(style="width: 9%;") {{$t('view.list.time')}}
|
th.nobreak(style="width: 9%;") {{$t('view.list.time')}}
|
||||||
th.nobreak(style="width: 15%;") {{$t('view.list.action')}}
|
th.nobreak(style="width: 15%;") {{$t('view.list.action')}}
|
||||||
div(v-if="list.length" :class="$style.content" ref="dom_listContent")
|
div(v-if="list.length" :class="$style.content" ref="dom_listContent")
|
||||||
material-virtualized-list(:list="list" key-name="songmid" ref="list" #default="{ item, index }" :item-height="37"
|
material-virtualized-list(:list="list" key-name="songmid" ref="list" #default="{ item, index }" :item-height="listItemHeight"
|
||||||
@scroll="handleScroll" containerClass="scroll" contentClass="list" @contextmenu.native.capture="handleContextMenu")
|
@scroll="handleScroll" containerClass="scroll" contentClass="list" @contextmenu.native.capture="handleContextMenu")
|
||||||
div.list-item(@click="handleDoubleClick($event, index)"
|
div.list-item(@click="handleDoubleClick($event, index)"
|
||||||
:class="[{ [$style.active]: isPlayList && playInfo.playIndex === index }, { selected: selectedIndex == index }, { active: selectdListDetailData.includes(item) }, { [$style.disabled]: !assertApiSupport(item.source) }]"
|
:class="[{ [$style.active]: isPlayList && playInfo.playIndex === index }, { selected: selectedIndex == index }, { active: selectdListDetailData.includes(item) }, { [$style.disabled]: !assertApiSupport(item.source) }]"
|
||||||
|
@ -73,6 +73,7 @@ import { mapMutations, mapGetters, mapActions } from 'vuex'
|
||||||
import { clipboardWriteText, assertApiSupport, openUrl, openSaveDir, saveLxConfigFile, selectDir, readLxConfigFile, filterFileName } from '../utils'
|
import { clipboardWriteText, assertApiSupport, openUrl, openSaveDir, saveLxConfigFile, selectDir, readLxConfigFile, filterFileName } from '../utils'
|
||||||
import musicSdk from '../utils/music'
|
import musicSdk from '../utils/music'
|
||||||
import { setListPosition, getListPosition, getListPrevSelectId } from '@renderer/utils/data'
|
import { setListPosition, getListPosition, getListPrevSelectId } from '@renderer/utils/data'
|
||||||
|
import { windowSizeList } from '@common/config'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -88,7 +89,6 @@ export default {
|
||||||
selectdListData: [],
|
selectdListData: [],
|
||||||
// isShowEditBtn: false,
|
// isShowEditBtn: false,
|
||||||
isShowDownloadMultiple: false,
|
isShowDownloadMultiple: false,
|
||||||
delayShow: false,
|
|
||||||
isShowListAdd: false,
|
isShowListAdd: false,
|
||||||
isShowListAddMultiple: false,
|
isShowListAddMultiple: false,
|
||||||
isShowListSortModal: false,
|
isShowListSortModal: false,
|
||||||
|
@ -286,6 +286,9 @@ export default {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
listItemHeight() {
|
||||||
|
return parseInt(windowSizeList.find(item => item.id == this.setting.windowSizeId).fontSize) / 16 * 37
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// selectdListDetailData(n) {
|
// selectdListDetailData(n) {
|
||||||
|
@ -313,7 +316,6 @@ export default {
|
||||||
if (to.query.scrollIndex != null) this.isToggleList = false
|
if (to.query.scrollIndex != null) this.isToggleList = false
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
this.delayShow = false
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.listId = to.query.id
|
this.listId = to.query.id
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -434,7 +436,7 @@ export default {
|
||||||
if (!this.list.length) return
|
if (!this.list.length) return
|
||||||
if (index == null) {
|
if (index == null) {
|
||||||
let location = getListPosition(this.listData.id) || 0
|
let location = getListPosition(this.listData.id) || 0
|
||||||
if (this.setting.list.isSaveScrollLocation && location) {
|
if (this.setting.list.isSaveScrollLocation && location != null) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.list.scrollTo(location)
|
this.$refs.list.scrollTo(location)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue