From 6565dfeab1be42cc74a63f5b522db3bb19045ed3 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期二, 23 七月 2024 15:03:00 +0800 Subject: [PATCH] 学前儿童视频小窗播放功能 --- src/books/childHealth/view/content/index.vue | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/src/books/childHealth/view/content/index.vue b/src/books/childHealth/view/content/index.vue index fb4a8ec..fd91aa9 100644 --- a/src/books/childHealth/view/content/index.vue +++ b/src/books/childHealth/view/content/index.vue @@ -276,6 +276,8 @@ // }, // 婊氬姩鐩戝惉 scrollFun(event) { + // 瑙嗛灏忕獥鏂规硶 + this.handleVideoPicture() // 鍒ゆ柇鍚戜笂婊氬姩杩樻槸鍚戜笅婊氬姩 if (event.target.scrollTop > this.previousScrollTop) { // 鍚戜笅 @@ -918,6 +920,24 @@ } }) } + }, + // 瑙嗛灏忕獥 + handleVideoPicture() { + let doms = ( + this.container ? this.container : document + ).querySelectorAll(".video"); + doms = Array.from(doms) + if(!doms.length) return false + const playVudio = doms + .reverse() + .find((item) => item.paused == false); + if(playVudio) { + const bottomGap = playVudio.getBoundingClientRect().bottom; + const topGap = playVudio.getBoundingClientRect().top; + if (bottomGap < 0 || topGap > window.innerHeight) { + playVudio.requestPictureInPicture(); + } + } } }, components: { -- Gitblit v1.9.1