mirror of
https://github.com/xfgryujk/blivechat.git
synced 2025-01-14 06:10:23 +08:00
不直接在Ticker修改父组件状态
This commit is contained in:
parent
6c92859408
commit
b5b9b2601a
@ -169,18 +169,25 @@ export default {
|
|||||||
return constants.getPriceConfig(message.price).pinTime
|
return constants.getPriceConfig(message.price).pinTime
|
||||||
},
|
},
|
||||||
updateProgress() {
|
updateProgress() {
|
||||||
|
// 更新进度
|
||||||
this.curTime = new Date()
|
this.curTime = new Date()
|
||||||
for (let i = 0; i < this.messages.length;) {
|
|
||||||
let message = this.messages[i]
|
// 删除过期的消息
|
||||||
|
let filteredMessages = []
|
||||||
|
let messagesChanged = false
|
||||||
|
for (let message of this.messages) {
|
||||||
let pinTime = this.getPinTime(message)
|
let pinTime = this.getPinTime(message)
|
||||||
if ((this.curTime - message.addTime) / (60 * 1000) >= pinTime) {
|
if ((this.curTime - message.addTime) / (60 * 1000) >= pinTime) {
|
||||||
if (this.pinnedMessage == message) {
|
messagesChanged = true
|
||||||
|
if (this.pinnedMessage === message) {
|
||||||
this.pinnedMessage = null
|
this.pinnedMessage = null
|
||||||
}
|
}
|
||||||
this.messages.splice(i, 1)
|
continue
|
||||||
} else {
|
|
||||||
i++
|
|
||||||
}
|
}
|
||||||
|
filteredMessages.push(message)
|
||||||
|
}
|
||||||
|
if (messagesChanged) {
|
||||||
|
this.$emit('update:messages', filteredMessages)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onItemClick(message) {
|
onItemClick(message) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<yt-live-chat-renderer class="style-scope yt-live-chat-app" style="--scrollbar-width:11px;" hide-timestamps
|
<yt-live-chat-renderer class="style-scope yt-live-chat-app" style="--scrollbar-width:11px;" hide-timestamps
|
||||||
@mousemove="refreshCantScrollStartTime"
|
@mousemove="refreshCantScrollStartTime"
|
||||||
>
|
>
|
||||||
<ticker class="style-scope yt-live-chat-renderer" :messages="paidMessages" :showGiftName="showGiftName"></ticker>
|
<ticker class="style-scope yt-live-chat-renderer" :messages.sync="paidMessages" :showGiftName="showGiftName"></ticker>
|
||||||
<yt-live-chat-item-list-renderer class="style-scope yt-live-chat-renderer" allow-scroll>
|
<yt-live-chat-item-list-renderer class="style-scope yt-live-chat-renderer" allow-scroll>
|
||||||
<div ref="scroller" id="item-scroller" class="style-scope yt-live-chat-item-list-renderer animated" @scroll="onScroll">
|
<div ref="scroller" id="item-scroller" class="style-scope yt-live-chat-item-list-renderer animated" @scroll="onScroll">
|
||||||
<div ref="itemOffset" id="item-offset" class="style-scope yt-live-chat-item-list-renderer" style="height: 0px;">
|
<div ref="itemOffset" id="item-offset" class="style-scope yt-live-chat-item-list-renderer" style="height: 0px;">
|
||||||
|
Loading…
Reference in New Issue
Block a user