We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
// vue // use-lyric.js const lyric = [ {text:'第一句',time:1000}, {text:'第二句',time:2000} ] export default function useLyric({lyric,currentTime}){ const currentLine = ref(0) const lyricScrollRef = ref(null) const lyricListRef = ref(null) const setLine = (line) =>{ currentLine.value = line scrollToLine(index) } function playLyric(){ if(lyric){ for(let i=0;i<lyric.length;i++){ if(lyric[i].time - currentTime.value>-1000 &&lyric[i].time - currentTime.value<0){ setLine(i) return } } } } function scrollToLine(index){ const scrollComp = lyricScrollRef.value const listEl = lyricListRef.value if (!listEl) return if (lineNum > 5) { // 滚动到当前行的前五行位置 const lineEl = listEl.children[lineNum - 5] scrollComp.scroll.scrollToElement(lineEl, 5000) } else { scrollComp.scroll.scrollTo(0, 0, 1000) } return lineNum } return { currentLine, setLine, playLyric, lyricListRef, lyricScrollRef } }
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: