diff --git a/public/index.html b/public/index.html index a3757bd..a6a2466 100644 --- a/public/index.html +++ b/public/index.html @@ -44,6 +44,9 @@ // 在什么时机发送musicList? // 通道准备好时即可发送 + // 获取对方的音乐列表 + // like对方的条目时亮起(双方高亮)(本地缓存)(可由对比缓存实现) + // ban对方的条目时灰掉(也禁止对方播放)(并保持ban表)(由插件实现) clientList.on('channel') diff --git a/public/music.js b/public/music.js index 5eaa00e..b39dc04 100644 --- a/public/music.js +++ b/public/music.js @@ -73,6 +73,13 @@ export default class MusicList { event.stopPropagation() this.delete(item) } + }), + Button({ + innerText: '喜欢', + onclick: event => { + event.stopPropagation() + // 留存到本地 + } }) ] }) @@ -80,7 +87,14 @@ export default class MusicList { } // 叠加数据(双方数据计数器上升) async push(item) { - console.log('叠加数据:', item) + console.log('叠加数据: 只增加UI不存储本地', item) + // 先检测是否已经存在 + const data = await this.store.get(item.id) + if (data) { + console.log('数据已存在:', data) + return + } + this.__add(item) } // 添加数据并添加UI add(item) {