1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <template>
- <div class="container">
- <video ref="videoPlayer" class="video-js"></video>
- </div>
- </template>
- <script>
- export default {
- name: 'VideoPlayer',
- props: {
- src: {
- type: String,
- default() {
- return ''
- }
- }
- },
- data() {
- return {
- player: null,
- options: {
- autoplay: false,
- controls: true,
- language: 'zh-CN', // 设置语言
- width: 300,
- height: 225,
- sources: [
- {
- src: this.src,
- type: rovide.type
- }
- ]
- }
- }
- },
- mounted() {
- this.player = this.$video(this.$refs.videoPlayer, this.options, () => {
- this.player.log('onPlayerReady', this)
- })
- },
- beforeDestroy() {
- if (this.player) {
- this.player.dispose()
- }
- }
- }
- </script>
- <style lang="less" scoped>
- </style>
|