mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
feat: update script tag to setup and use shallowRef for Artplayer instance
This commit is contained in:
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" />
|
<div ref="$container" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import Artplayer from 'artplayer'
|
import Artplayer from 'artplayer'
|
||||||
import { onBeforeUnmount, onMounted, ref, shallowRef } from 'vue'
|
import { onBeforeUnmount, onMounted, ref, shallowRef } from 'vue'
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ Importing `Artplayer` will automatically import `artplayer.d.ts`
|
|||||||
```vue{3}
|
```vue{3}
|
||||||
<script setup>
|
<script setup>
|
||||||
import Artplayer from 'artplayer';
|
import Artplayer from 'artplayer';
|
||||||
const art = ref<Artplayer>(null);
|
const art = shallowRef<Artplayer>(null);
|
||||||
art.value = new Artplayer();
|
art.value = new Artplayer();
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ https://unpkg.com/artplayer/dist/artplayer.js
|
|||||||
<div ref="$container" />
|
<div ref="$container" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import Artplayer from 'artplayer'
|
import Artplayer from 'artplayer'
|
||||||
import { onBeforeUnmount, onMounted, ref, shallowRef } from 'vue'
|
import { onBeforeUnmount, onMounted, ref, shallowRef } from 'vue'
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ export default App
|
|||||||
```vue{3}
|
```vue{3}
|
||||||
<script setup>
|
<script setup>
|
||||||
import Artplayer from 'artplayer';
|
import Artplayer from 'artplayer';
|
||||||
const art = ref<Artplayer>(null);
|
const art = shallowRef<Artplayer>(null);
|
||||||
art.value = new Artplayer();
|
art.value = new Artplayer();
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in new issue
Block a user