lex hace 1 año
padre
commit
82cdb4d9d2
Se han modificado 1 ficheros con 6 adiciones y 3 borrados
  1. 6 3
      src/components/video-tcplayer.vue

+ 6 - 3
src/components/video-tcplayer.vue

@@ -68,6 +68,7 @@ export default {
       }); // player-container-id 为播放器容器 ID,必须与 html 中一致
       if (this.player) {
         this.player.src(this.src); // url 播放地址
+        this.player.poster(this.poster || "");
         // this.player.elements.container ? (this.player.elements.container.style.height = this.height || "2rem") : null;
 
         this.player.on("play", () => {
@@ -94,9 +95,11 @@ export default {
     },
   },
   beforeDestroy() {
-    this.player.destroy();
-    this.player.pause();
-    this.player.src("");
+    if (this.player) {
+      this.player.destroy();
+      this.player.pause();
+      this.player.src("");
+    }
   },
 };
 </script>