feat: update script tag to setup and use shallowRef for Artplayer instance

This commit is contained in:
Harvey Zack committed 2025-08-25 10:40:01 +08:00
1 parent 745d2b4848
commit ddbcdbd459
2 files changed
+4 -4

No files matched your search

@@ -87,7 +87,7 @@ The player's size depends on the size of the container `container`, so your cont
<div ref="$container" />
</template>
<script>
<script setup>
import Artplayer from 'artplayer'
import { onBeforeUnmount, onMounted, ref, shallowRef } from 'vue'
@@ -220,7 +220,7 @@ Importing `Artplayer` will automatically import `artplayer.d.ts`
```vue{3}
<script setup>
import Artplayer from 'artplayer';
const art = ref<Artplayer>(null);
const art = shallowRef<Artplayer>(null);
art.value = new Artplayer();
</script>
```
+2 -2
View File
@@ -88,7 +88,7 @@ https://unpkg.com/artplayer/dist/artplayer.js
<div ref="$container" />
</template>
<script>
<script setup>
import Artplayer from 'artplayer'
import { onBeforeUnmount, onMounted, ref, shallowRef } from 'vue'
@@ -220,7 +220,7 @@ export default App
```vue{3}
<script setup>
import Artplayer from 'artplayer';
const art = ref<Artplayer>(null);
const art = shallowRef<Artplayer>(null);
art.value = new Artplayer();
</script>
```