From 6bfd96942de6c1bef227960dcb8b6f76a32b39f3 Mon Sep 17 00:00:00 2001 From: buvta <12312540+buvta@users.noreply.github.com> Date: Thu, 21 Jan 2021 15:44:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E9=A2=91=E9=81=93=E9=A6=96?= =?UTF-8?q?=E5=B0=BE=E9=83=A8=E8=87=AA=E5=8A=A8=E8=BD=AE=E6=9B=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Play.vue | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/components/Play.vue b/src/components/Play.vue index e95b037..e1f90de 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -787,13 +787,10 @@ export default { }, prevEvent () { if (this.video.iptv) { - const index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID) - if (index >= 1) { - const channel = this.channelList[index - 1] - this.playChannel(channel) - } else { - this.$message.warning('这已经是第一个频道了。') - } + let index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID) + index = index === 0 ? this.channelList.length - 1 : index - 1 + const channel = this.channelList[index] + this.playChannel(channel) } else { if (this.video.info.index >= 1) { this.video.info.index-- @@ -805,13 +802,10 @@ export default { }, nextEvent () { if (this.video.iptv) { - const index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID) - if (index < (this.channelList.length - 1)) { - const channel = this.channelList[index + 1] - this.playChannel(channel) - } else { - this.$message.warning('这已经是最后一个频道了。') - } + let index = this.channelList.findIndex(obj => obj.id === this.video.iptv.channelID) + index = index === this.channelList.length - 1 ? 0 : index + 1 + const channel = this.channelList[index] + this.playChannel(channel) } else { if (this.video.info.index < (this.right.list.length - 1)) { this.video.info.index++