SC固定栏支持滚动

This commit is contained in:
John Smith 2024-11-24 20:18:56 +08:00
parent 1244210bfe
commit aae8bd2f15
2 changed files with 12 additions and 4 deletions

View File

@ -22,7 +22,9 @@ yt-live-chat-ticker-renderer {
#items.yt-live-chat-ticker-renderer {
height: 32px;
overflow: hidden;
/* 为了支持滚动 */
/* overflow: hidden; */
overflow: visible;
white-space: nowrap;
padding: 0 24px 8px 24px;
}

View File

@ -1,6 +1,6 @@
<template>
<yt-live-chat-ticker-renderer :hidden="showMessages.length === 0">
<div id="container" dir="ltr" class="style-scope yt-live-chat-ticker-renderer">
<el-scrollbar ref="scrollbar" id="container" dir="ltr" class="style-scope yt-live-chat-ticker-renderer">
<transition-group tag="div" :css="false" @enter="onTickerItemEnter" @leave="onTickerItemLeave"
id="items" class="style-scope yt-live-chat-ticker-renderer"
>
@ -22,7 +22,7 @@
</div>
</yt-live-chat-ticker-paid-message-item-renderer>
</transition-group>
</div>
</el-scrollbar>
<template v-if="pinnedMessage">
<membership-item :key="pinnedMessage.id" v-if="pinnedMessage.type === MESSAGE_TYPE_MEMBER"
class="style-scope yt-live-chat-ticker-renderer"
@ -110,7 +110,11 @@ export default {
el.style.width = 0
await this.$nextTick()
el.style.width = `${width}px`
window.setTimeout(done, 200)
window.setTimeout(() => {
done()
// el-scrollbarupdate
this.$refs.scrollbar.update()
}, 200)
},
onTickerItemLeave(el, done) {
el.classList.add('sliding-down')
@ -122,6 +126,8 @@ export default {
el.classList.remove('collapsing')
el.style.width = 'auto'
done()
// el-scrollbarupdate
this.$refs.scrollbar.update()
}, 200)
}, 200)
},