Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
map-demo
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-10-30 17:49:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
80fa1e2b4eced705a5ede736a4677e7431a61847
80fa1e2b
1 parent
90553412
自动播放音频的高度优化
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
src/components/audioList.vue
src/components/audioList.vue
View file @
80fa1e2
...
...
@@ -64,7 +64,7 @@ const onHeightChange = ({ height }) => { // 监听高度变化
}
// 添加可滚动高度
if (height === (0.2 * window.innerHeight)) {
let str = $('.audio-item').
height() * audio_list.value.length
;
let str = $('.audio-item').
outerHeight() * (audio_list.value.length + 1.25)
;
$('.audio-list').css('marginBottom', `${str}px`);
}
}
...
...
@@ -81,9 +81,11 @@ watch(
if (v) {
// 自动打开第一个
handleAudioPlay(audio_list.value[0], 0);
// 添加可滚动高度
let str = $('.audio-item').height() * audio_list.value.length;
$('.audio-list').css('marginBottom', `${str}px`);
nextTick(() => {
// 添加可滚动高度
let str = $('.audio-item').outerHeight() * (audio_list.value.length + 1.25);
$('.audio-list').css('marginBottom', `${str}px`);
})
} else {
onClose();
}
...
...
@@ -251,10 +253,8 @@ const handleAudioPlay = (item, index) => {
console.log('Operation is too fast, audio play fails')
})
}
if (index) {
// 指定滚动到播放位置
scrollToId(index);
}
// 指定滚动到播放位置
scrollToId(index);
}
const scrollToId = (index) => { // 滚动到指定元素
...
...
Please
register
or
login
to post a comment