Skip to content

Commit

Permalink
fix: prevent vue3 component reload too frequently (AirenSoft#400)
Browse files Browse the repository at this point in the history
Co-authored-by: billy <[email protected]>
  • Loading branch information
miaulightouch and billy authored Dec 26, 2023
1 parent ed2fd35 commit 0c727b8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/vue3/src/OvenPlayer.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, onUnmounted, onUpdated } from 'vue';
import { ref, watch, onMounted, onUnmounted } from 'vue';
import OvenPlayer from 'ovenplayer';
import type { OvenPlayerConfig, OvenPlayerInstance, OvenPlayerEvents } from 'ovenplayer';
Expand Down Expand Up @@ -179,10 +179,14 @@ onMounted(createPlayer);
onUnmounted(removePlayer);
onUpdated(() => {
removePlayer();
createPlayer();
});
watch(
() => props.config,
() => {
removePlayer();
createPlayer();
},
{ deep: true }
);
</script>

<template>
Expand Down

0 comments on commit 0c727b8

Please sign in to comment.