热力上图功能BUG处理

This commit is contained in:
luolx 2025-08-01 22:53:50 +08:00
parent c670c0d305
commit 1010549f04
1 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,70 @@
<script setup>
import { onMounted, onBeforeUnmount, watch } from "vue";
const props = defineProps({
videoUrl: String
});
const playerContainer = ref(null);
const player = ref(null);
const initPlayer = () => {
if (!props.videoUrl || !playerContainer.value) return;
//
if (player.value) {
player.value.JS_StopRealPlayAll();
player.value.JS_Destroy();
playerContainer.value.innerHTML = ""; //
}
//
const container = document.createElement("div");
container.id = "player-container";
container.style.width = "100%";
container.style.height = "100%";
playerContainer.value.appendChild(container);
//
player.value = new JSPlugin({
szId: "player-container", // ID
szBasePath: "js/",
openDebug: true,
supportGMProtocol: true, //
iWidth:"100%",
iHeight:"100%",
});
player.value.JS_Play(props.videoUrl, {
onError: (err) => console.error("播放失败:", err)
});
};
// URL
watch(() => props.videoUrl, initPlayer);
onMounted(initPlayer);
onBeforeUnmount(() => {
if (player.value) {
player.value.JS_StopRealPlayAll();
player.value.JS_Destroy();
}
if (playerContainer.value) {
playerContainer.value.innerHTML = ""; //
}
});
</script>
<template>
<!-- 固定结构不设ID -->
<div ref="playerContainer" class="video-monitor-container"></div>
</template>
<style scoped>
.video-monitor-container {
width: 95%;
height: 100%;
min-height: 500px; /* 防止折叠 */
}
</style>