diff --git a/src/components/globals/EmbedVideo.vue b/src/components/globals/EmbedVideo.vue index 35a7fb0..a2f5ec0 100644 --- a/src/components/globals/EmbedVideo.vue +++ b/src/components/globals/EmbedVideo.vue @@ -12,7 +12,9 @@ export default { name: 'EmbedVideo', props: { - src: { type: String, required: true } + src: { type: String, required: true }, + type: { type: String, required: true }, + full: { type: Boolean, default: false } }, data () { @@ -54,22 +56,23 @@ export default { item () { const embed = this.embed + let src = this.src + const attrs = this.type === 'iframe' ? { allowfullscreen: true } : { controls: true } + + if (this.full && this.type === 'iframe') { + attrs.width = '100%' + attrs.height = '100%' + } if (embed) { const query = Object.entries(embed.params).map(entry => entry.join('=')).join('&') - const and = embed.url.indexOf('?') >= 0 ? '&' : '?' - return { - type: 'iframe', - src: this.src.replace(embed.reg, embed.url) + and + query, - attrs: { allowfullscreen: true } + src = this.src.replace(embed.reg, embed.url) + if (!this.full) { + src += embed.url.indexOf('?') >= 0 ? '&' : '?' + query } } - return { - type: 'video', - src: this.src, - attrs: { controls: true } - } + return { type: this.type, src, attrs } } } }