72 lines
1.8 KiB
JavaScript
72 lines
1.8 KiB
JavaScript
|
import Vue from 'vue'
|
||
|
|
||
|
export default Vue.extend({
|
||
|
name: 'FtListVideo',
|
||
|
props: {
|
||
|
data: {
|
||
|
type: Object,
|
||
|
required: true
|
||
|
}
|
||
|
},
|
||
|
data: function () {
|
||
|
return {
|
||
|
playlistLink: '',
|
||
|
channelLink: '',
|
||
|
title: 'Pop Music Playlist - Timeless Pop Songs (Updated Weekly 2020)',
|
||
|
thumbnail: 'https://i.ytimg.com/vi/JGwWNGJdvx8/mqdefault.jpg',
|
||
|
channelName: '#RedMusic: Just Hits',
|
||
|
videoCount: 200,
|
||
|
description: ''
|
||
|
}
|
||
|
},
|
||
|
computed: {
|
||
|
listType: function () {
|
||
|
return this.$store.getters.getListType
|
||
|
},
|
||
|
|
||
|
playlistId: function () {
|
||
|
return this.playlistLink.replace('https://www.youtube.com/playlist?list=', '')
|
||
|
},
|
||
|
|
||
|
channelId: function () {
|
||
|
let id = this.channelLink.replace('https://www.youtube.com/user/', '')
|
||
|
id = id.replace('https://www.youtube.com/channel/', '')
|
||
|
return id
|
||
|
}
|
||
|
},
|
||
|
mounted: function () {
|
||
|
if (typeof (this.data.author) === 'object') {
|
||
|
this.parseLocalData()
|
||
|
} else {
|
||
|
this.parseInvidiousData()
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
parseInvidiousData: function () {
|
||
|
this.title = this.data.title
|
||
|
this.thumbnail = this.data.playlistThumbnail
|
||
|
this.channelName = this.data.author
|
||
|
this.channelLink = this.data.authorUrl
|
||
|
this.playlistLink = this.data.playlistId
|
||
|
this.videoCount = this.data.videoCount
|
||
|
},
|
||
|
|
||
|
parseLocalData: function () {
|
||
|
this.title = this.data.title
|
||
|
this.thumbnail = this.data.thumbnail
|
||
|
this.channelName = this.data.author.name
|
||
|
this.channelLink = this.data.author.ref
|
||
|
this.playlistLink = this.data.link
|
||
|
this.videoCount = parseInt(this.data.length.split(' ')[0])
|
||
|
},
|
||
|
|
||
|
goToPlaylist: function (id) {
|
||
|
this.$router.push({ path: `/playlist/${id}` })
|
||
|
},
|
||
|
|
||
|
goToChannel: function (id) {
|
||
|
console.log(id)
|
||
|
}
|
||
|
}
|
||
|
})
|