mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
添加vue组件
This commit is contained in:
1 parent
ba5e680887
commit
33e73810cb
23 files changed
+150
-20
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import Artplayer from 'artplayer';
|
||||
import 'artplayer/dist/artplayer.css';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
instance: null,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
option: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
getInstance: Function,
|
||||
},
|
||||
mounted() {
|
||||
this.instance = new Artplayer({
|
||||
...this.option,
|
||||
container: this.$refs.artRef,
|
||||
});
|
||||
|
||||
this.$emit('getInstance', this.instance);
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.instance && this.instance.destroy) {
|
||||
this.instance.destroy();
|
||||
}
|
||||
},
|
||||
render(h) {
|
||||
return h(
|
||||
'div',
|
||||
{
|
||||
ref: 'artRef',
|
||||
},
|
||||
'render',
|
||||
);
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user