Files
ArtPlayer/packages/artplayer-vue/src/index.js
T
2019-04-16 10:12:11 +08:00

40 lines
784 B
JavaScript

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',
);
},
};