Sfoglia il codice sorgente

perf: 优化视频组件

奔跑的面条 3 anni fa
parent
commit
b9e3053fe3

BIN
src/assets/images/chart/informations/photo.png


BIN
src/assets/images/chart/informations/video.png


+ 0 - 2
src/packages/components/Informations/Mores/Video/config.ts

@@ -9,8 +9,6 @@ export const option = {
   dataset: video,
   // 循环播放
   loop: true,
-  // 自动播放
-  autoplay: true,
   // 静音
   muted: true,
   // 适应方式

+ 0 - 3
src/packages/components/Informations/Mores/Video/config.vue

@@ -9,9 +9,6 @@
     </setting-item-box>
 
     <setting-item-box name="控制">
-      <setting-item>
-        <n-checkbox v-model:checked="optionData.autoplay" size="small">自动播放</n-checkbox>
-      </setting-item>
       <setting-item>
         <n-checkbox v-model:checked="optionData.loop" size="small">循环播放</n-checkbox>
       </setting-item>

+ 3 - 2
src/packages/components/Informations/Mores/Video/index.ts

@@ -1,5 +1,5 @@
-import image from '@/assets/images/chart/informations/photo.png'
-import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
+import image from '@/assets/images/chart/informations/video.png'
+import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
 import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
 
 export const VideoConfig: ConfigType = {
@@ -10,5 +10,6 @@ export const VideoConfig: ConfigType = {
   category: ChatCategoryEnum.MORE,
   categoryName: ChatCategoryEnumName.MORE,
   package: PackagesCategoryEnum.INFORMATIONS,
+  chartFrame: ChartFrameEnum.ECHARTS,
   image
 }

+ 2 - 6
src/packages/components/Informations/Mores/Video/index.vue

@@ -7,8 +7,8 @@
     preload="auto"
     crossOrigin="anonymous"
     playsinline
+    autoplay
     :loop="option.loop"
-    :autoplay="option.autoplay"
     :muted="option.muted"
     :width="w"
     :height="h"
@@ -47,12 +47,8 @@ watch(
     if (!vVideoRef.value) return
     const video: any = vVideoRef.value
     video.loop = option.loop
-    video.autoplay = option.autoplay
     video.muted = option.muted
-
-    // 控制是否播放还是停止在第一帧
-    !option.autoplay && (video.pause(), (video.currentTime = 0))
-    option.autoplay && video.play()
+    video.play()
   },
   {
     immediate: true,