add vue2 demo

This commit is contained in:
Harvey committed 2022-06-13 15:00:06 +08:00
1 parent 102037dd42
commit 107d884274
32 files changed
+270

No files matched your search

@@ -0,0 +1,36 @@
<template>
<div ref="artRef"></div>
</template>
<script>
import Artplayer from 'artplayer';
export default {
data() {
return {
instance: null,
};
},
props: {
option: {
type: Object,
required: true,
},
},
mounted() {
this.instance = new Artplayer({
...this.option,
container: this.$refs.artRef,
});
this.$nextTick(() => {
this.$emit('get-instance', this.instance);
});
},
beforeUnmount() {
if (this.instance && this.instance.destroy) {
this.instance.destroy(false);
}
},
};
</script>