mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Made a channel page
This commit is contained in:
35
frontend/components/Channel.vue
Normal file
35
frontend/components/Channel.vue
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="parallel-containers">
|
||||||
|
<Player class="player" />
|
||||||
|
<Playlist class="playlist" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import store from "@/store";
|
||||||
|
import Player from "@/components/player/Player";
|
||||||
|
import Playlist from "@/components/playlist/Playlist";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Player,
|
||||||
|
Playlist
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.parallel-containers {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
& .player {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
& .playlist {
|
||||||
|
width: 40vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="conatiner">
|
<div class="conatiner">
|
||||||
<h1>Player</h1>
|
|
||||||
<YouTube
|
<YouTube
|
||||||
@end="end('youtube')"
|
@end="end('youtube')"
|
||||||
@pause="pause('youtube')"
|
@pause="pause('youtube')"
|
||||||
@@ -17,7 +16,7 @@ import YouTube from "@/components/player/YouTube";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
YouTube,
|
YouTube
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ export default {
|
|||||||
player: null,
|
player: null,
|
||||||
playerReady: false,
|
playerReady: false,
|
||||||
currentPlaying: {},
|
currentPlaying: {},
|
||||||
currentIsThis: false
|
currentIsThis: false,
|
||||||
|
gettingPosition: false,
|
||||||
|
wasPaused: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -56,8 +58,10 @@ export default {
|
|||||||
if (this.player == null) {
|
if (this.player == null) {
|
||||||
this.createYoutubeObjectWithId(this.nowPlaying.id);
|
this.createYoutubeObjectWithId(this.nowPlaying.id);
|
||||||
} else {
|
} else {
|
||||||
|
console.log("new np", this.currentPlaying.id, nowPlaying.id);
|
||||||
if (this.currentPlaying.id != nowPlaying.id) {
|
if (this.currentPlaying.id != nowPlaying.id) {
|
||||||
try {
|
try {
|
||||||
|
console.log("loading");
|
||||||
this.player.loadVideoById(nowPlaying.id, {
|
this.player.loadVideoById(nowPlaying.id, {
|
||||||
start: nowPlaying.seek,
|
start: nowPlaying.seek,
|
||||||
end: nowPlaying.end
|
end: nowPlaying.end
|
||||||
@@ -65,6 +69,7 @@ export default {
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
} else {
|
} else {
|
||||||
this.player.seekTo(nowPlaying.seek);
|
this.player.seekTo(nowPlaying.seek);
|
||||||
|
console.log("seeking");
|
||||||
}
|
}
|
||||||
this.currentPlaying = nowPlaying;
|
this.currentPlaying = nowPlaying;
|
||||||
}
|
}
|
||||||
@@ -128,7 +133,14 @@ export default {
|
|||||||
},
|
},
|
||||||
onPlayerReady(event) {
|
onPlayerReady(event) {
|
||||||
console.log("event from onPlayerReady", event);
|
console.log("event from onPlayerReady", event);
|
||||||
|
|
||||||
|
this.player.setVolume(0);
|
||||||
event.target.playVideo();
|
event.target.playVideo();
|
||||||
|
setInterval(() => {
|
||||||
|
console.log(
|
||||||
|
this.player.getCurrentTime() + " - " + this.player.getDuration()
|
||||||
|
);
|
||||||
|
}, 1000);
|
||||||
},
|
},
|
||||||
checkForInitialLoadAndSeek() {
|
checkForInitialLoadAndSeek() {
|
||||||
if (!this.initialLoad) {
|
if (!this.initialLoad) {
|
||||||
@@ -142,6 +154,10 @@ export default {
|
|||||||
if (event.data === this.PLAYER_STATES.PLAYING) {
|
if (event.data === this.PLAYER_STATES.PLAYING) {
|
||||||
console.log("playing");
|
console.log("playing");
|
||||||
this.checkForInitialLoadAndSeek();
|
this.checkForInitialLoadAndSeek();
|
||||||
|
if (this.wasPaused) {
|
||||||
|
this.wasPaused = false;
|
||||||
|
this.$root.$options.methods.getPosition();
|
||||||
|
}
|
||||||
} else if (event.data === this.PLAYER_STATES.ENDED) {
|
} else if (event.data === this.PLAYER_STATES.ENDED) {
|
||||||
console.log("ended");
|
console.log("ended");
|
||||||
this.$root.$options.methods.songEnd();
|
this.$root.$options.methods.songEnd();
|
||||||
@@ -149,6 +165,9 @@ export default {
|
|||||||
console.log("not started");
|
console.log("not started");
|
||||||
} else if (event.data === this.PLAYER_STATES.BUFFERING) {
|
} else if (event.data === this.PLAYER_STATES.BUFFERING) {
|
||||||
console.log("buffering");
|
console.log("buffering");
|
||||||
|
} else if (event.data === this.PLAYER_STATES.PAUSED) {
|
||||||
|
console.log("pasued");
|
||||||
|
this.wasPaused = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
errorHandler(error) {
|
errorHandler(error) {
|
||||||
@@ -159,8 +178,8 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
#player {
|
#youtubePlayer {
|
||||||
width: 100vw !important;
|
width: 100% !important;
|
||||||
height: 60vh;
|
height: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<div class="pagination-buttons">
|
<div class="pagination-buttons">
|
||||||
<v-btn text @click="firstPage" :disabled="disabledPrev" class="first"><</v-btn>
|
<v-btn text @click="firstPage" :disabled="disabledPrev" class="first"><</v-btn>
|
||||||
<v-btn text @click="prevPage" :disabled="disabledPrev">previous</v-btn>
|
<v-btn text @click="prevPage" :disabled="disabledPrev">previous</v-btn>
|
||||||
<span>{{ page + 1 }} / {{ pages }}</span>
|
<span>{{ page + 1 }} / {{ pages }}</span>
|
||||||
<v-btn text @click="nextPage" :disabled="disabledNext">next</v-btn>
|
<v-btn text @click="nextPage" :disabled="disabledNext">next</v-btn>
|
||||||
<v-btn text @click="lastPage" :disabled="disabledNext" class="last">></v-btn>
|
<v-btn text @click="lastPage" :disabled="disabledNext" class="last">></v-btn>
|
||||||
</div>
|
</div>
|
||||||
@@ -40,14 +40,13 @@ import ContextMenu from "@/components/playlist/ContextMenu";
|
|||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Song,
|
Song,
|
||||||
ContextMenu,
|
ContextMenu
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
paginatedList: function() {
|
paginatedList: function() {
|
||||||
return this.playlist.slice(
|
return this.playlist
|
||||||
this.page * this.perPage,
|
.filter(song => !song.now_playing)
|
||||||
(1 + this.page) * this.perPage
|
.slice(this.page * this.perPage, (1 + this.page) * this.perPage);
|
||||||
);
|
|
||||||
},
|
},
|
||||||
disabledPrev: function() {
|
disabledPrev: function() {
|
||||||
return this.page == 0;
|
return this.page == 0;
|
||||||
@@ -98,7 +97,7 @@ export default {
|
|||||||
contextMenuOpen: false,
|
contextMenuOpen: false,
|
||||||
contextOnElement: {},
|
contextOnElement: {},
|
||||||
page: 0,
|
page: 0,
|
||||||
perPage: 10,
|
perPage: 12
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -108,23 +107,28 @@ export default {
|
|||||||
.playlist-conatiner {
|
.playlist-conatiner {
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
margin:auto;
|
margin: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #2d2d2d;
|
background: #2d2d2d;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
& .playlist-element {
|
// & .playlist-element {
|
||||||
height: 100%;;
|
// height: 100%;
|
||||||
}
|
// }
|
||||||
|
|
||||||
.pagination-buttons {
|
.pagination-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
margin: auto;
|
||||||
|
|
||||||
& span {
|
& span {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -133,7 +137,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
& button {
|
& button {
|
||||||
width: 35%;
|
width: 20%;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: white;
|
color: white;
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ export default {
|
|||||||
if (e.target.className === "more-info-button") {
|
if (e.target.className === "more-info-button") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$root.$options.methods.vote(this.id);
|
||||||
console.log("Clicked on song with info", this.title, this.id);
|
console.log("Clicked on song with info", this.title, this.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +94,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
box-shadow: 0px 0px 2px #000000;
|
box-shadow: 0px 0px 2px #000000;
|
||||||
background: #FFFFFF20;
|
background: #ffffff20;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
margin: 5px 5px;
|
margin: 5px 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import io from "socket.io-client";
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
socket: null,
|
|
||||||
alreadyCreated: false
|
alreadyCreated: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -15,6 +14,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.socket = io("localhost:8080");
|
this.socket = io("localhost:8080");
|
||||||
console.log("mounted");
|
console.log("mounted");
|
||||||
|
console.log(this.socket);
|
||||||
this.addListeners();
|
this.addListeners();
|
||||||
this.alreadyCreated = true;
|
this.alreadyCreated = true;
|
||||||
},
|
},
|
||||||
@@ -24,23 +24,70 @@ export default {
|
|||||||
},
|
},
|
||||||
channel: function() {
|
channel: function() {
|
||||||
return store.getters["playerModule/channel"];
|
return store.getters["playerModule/channel"];
|
||||||
|
},
|
||||||
|
socket: {
|
||||||
|
set: function(socket) {
|
||||||
|
store.dispatch("socketModule/setSocket", socket);
|
||||||
|
},
|
||||||
|
get: function() {
|
||||||
|
console.log(store);
|
||||||
|
return store.getters["socketModule/socket"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
emitToBackend(event, msg) {
|
emitToBackend(event, msg) {
|
||||||
this.socket.emit(event, msg);
|
store.getters["socketModule/socket"].emit(event, msg);
|
||||||
},
|
},
|
||||||
songEnd() {
|
songEnd() {
|
||||||
this.socket.emit("end", { id: this.nowPlaying, channel: this.channel });
|
const nowPlaying = store.getters["playerModule/nowPlaying"];
|
||||||
|
const channel = store.getters["playerModule/channel"];
|
||||||
|
store.getters["socketModule/socket"].emit("end", {
|
||||||
|
id: nowPlaying.id,
|
||||||
|
channel: channel
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getPosition() {
|
getPosition() {
|
||||||
this.socket.emit("pos", { channel: this.channel });
|
store.getters["socketModule/socket"].emit("pos", {
|
||||||
|
channel: store.getters["playerModule/channel"]
|
||||||
|
});
|
||||||
|
},
|
||||||
|
vote(id) {
|
||||||
|
store.getters["socketModule/socket"].emit("vote", {
|
||||||
|
channel: store.getters["playerModule/channel"],
|
||||||
|
id: id,
|
||||||
|
type: "pos"
|
||||||
|
});
|
||||||
},
|
},
|
||||||
addListeners() {
|
addListeners() {
|
||||||
|
console.log(this.socket);
|
||||||
this.socket.on("channel", msg => {
|
this.socket.on("channel", msg => {
|
||||||
console.log("list", msg);
|
console.log("list", msg);
|
||||||
if (msg.type == "list") {
|
if (msg.type == "list") {
|
||||||
|
msg.playlist.sort(
|
||||||
|
predicate(
|
||||||
|
{
|
||||||
|
name: "votes",
|
||||||
|
reverse: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "added",
|
||||||
|
reverse: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "title",
|
||||||
|
reverse: false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
store.dispatch("playerModule/setPlaylist", msg.playlist);
|
store.dispatch("playerModule/setPlaylist", msg.playlist);
|
||||||
|
} else if (msg.type == "vote") {
|
||||||
|
const playlist = store.getters["playerModule/playlist"];
|
||||||
|
let songToUpdate = playlist.find(song => song.id == msg.value);
|
||||||
|
console.log(songToUpdate);
|
||||||
|
songToUpdate.votes += 1;
|
||||||
|
songToUpdate.added = msg.time;
|
||||||
|
store.dispatch("playerModule/setPlaylist", playlist);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -51,24 +98,57 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.socket.on("np", msg => {
|
this.socket.on("np", msg => {
|
||||||
|
console.log("got now playing");
|
||||||
|
const playlist = store.getters["playerModule/playlist"];
|
||||||
|
const currentPlaying = playlist.find(song => song.now_playing == true);
|
||||||
if (msg.np.length == 0) {
|
if (msg.np.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msg.conf.length == 0) {
|
if (msg.conf.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let nowPlaying = msg.np[0];
|
let nowPlaying = msg.np[0];
|
||||||
let channelSettings = msg.conf[0];
|
let channelSettings = msg.conf[0];
|
||||||
let timeSinceStart =
|
let timeSinceStart =
|
||||||
msg.time - channelSettings.startTime + nowPlaying.start;
|
msg.time - channelSettings.startTime + nowPlaying.start;
|
||||||
nowPlaying.seek = timeSinceStart;
|
nowPlaying.seek = timeSinceStart;
|
||||||
|
|
||||||
|
const newNowPlaying = playlist.find(song => song.id == nowPlaying.id);
|
||||||
|
newNowPlaying.now_playing = true;
|
||||||
|
if (
|
||||||
|
currentPlaying != undefined &&
|
||||||
|
currentPlaying.id != newNowPlaying.id
|
||||||
|
) {
|
||||||
|
currentPlaying.now_playing = false;
|
||||||
|
currentPlaying.added = channelSettings.startTime;
|
||||||
|
console.log(currentPlaying);
|
||||||
|
}
|
||||||
|
|
||||||
|
playlist.sort(
|
||||||
|
predicate(
|
||||||
|
{
|
||||||
|
name: "votes",
|
||||||
|
reverse: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "added",
|
||||||
|
reverse: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "title",
|
||||||
|
reverse: false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
store.dispatch("playerModule/setPlaylist", playlist);
|
||||||
store.dispatch("playerModule/setNowPlaying", nowPlaying);
|
store.dispatch("playerModule/setNowPlaying", nowPlaying);
|
||||||
store.dispatch("playerModule/setChannelSettings", channelSettings);
|
store.dispatch("playerModule/setChannelSettings", channelSettings);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.socket.on("update_required", msg => {
|
this.socket.on("update_required", msg => {
|
||||||
console.log("update required");
|
console.log("update required", msg);
|
||||||
});
|
});
|
||||||
this.socket.on("connect", msg => {
|
this.socket.on("connect", msg => {
|
||||||
this.socket.emit("list", {
|
this.socket.emit("list", {
|
||||||
@@ -79,3 +159,64 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function predicate() {
|
||||||
|
var fields = [],
|
||||||
|
n_fields = arguments.length,
|
||||||
|
field,
|
||||||
|
name,
|
||||||
|
cmp;
|
||||||
|
|
||||||
|
var default_cmp = function(a, b) {
|
||||||
|
if (a == undefined) a = 0;
|
||||||
|
if (b == undefined) b = 0;
|
||||||
|
if (a === b) return 0;
|
||||||
|
return a < b ? -1 : 1;
|
||||||
|
},
|
||||||
|
getCmpFunc = function(primer, reverse) {
|
||||||
|
var dfc = default_cmp,
|
||||||
|
// closer in scope
|
||||||
|
cmp = default_cmp;
|
||||||
|
if (primer) {
|
||||||
|
cmp = function(a, b) {
|
||||||
|
return dfc(primer(a), primer(b));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (reverse) {
|
||||||
|
return function(a, b) {
|
||||||
|
return -1 * cmp(a, b);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return cmp;
|
||||||
|
};
|
||||||
|
|
||||||
|
// preprocess sorting options
|
||||||
|
for (var i = 0; i < n_fields; i++) {
|
||||||
|
field = arguments[i];
|
||||||
|
if (typeof field === "string") {
|
||||||
|
name = field;
|
||||||
|
cmp = default_cmp;
|
||||||
|
} else {
|
||||||
|
name = field.name;
|
||||||
|
cmp = getCmpFunc(field.primer, field.reverse);
|
||||||
|
}
|
||||||
|
fields.push({
|
||||||
|
name: name,
|
||||||
|
cmp: cmp
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// final comparison function
|
||||||
|
return function(A, B) {
|
||||||
|
var name, result;
|
||||||
|
for (var i = 0; i < n_fields; i++) {
|
||||||
|
result = 0;
|
||||||
|
field = fields[i];
|
||||||
|
name = field.name;
|
||||||
|
|
||||||
|
result = field.cmp(A[name], B[name]);
|
||||||
|
if (result !== 0) break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
@@ -18,16 +17,12 @@ export default {
|
|||||||
PLAYING: 1,
|
PLAYING: 1,
|
||||||
UNSTARTED: -1
|
UNSTARTED: -1
|
||||||
},
|
},
|
||||||
socket: null,
|
|
||||||
channel: "summér"
|
channel: "summér"
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
channel: state => {
|
channel: state => {
|
||||||
return state.channel;
|
return state.channel;
|
||||||
},
|
},
|
||||||
socket: state => {
|
|
||||||
return state.socket
|
|
||||||
},
|
|
||||||
PLAYER_STATES: state => {
|
PLAYER_STATES: state => {
|
||||||
return state.PLAYER_STATES;
|
return state.PLAYER_STATES;
|
||||||
},
|
},
|
||||||
|
|||||||
21
frontend/modules/socketModule.js
Normal file
21
frontend/modules/socketModule.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
export default {
|
||||||
|
namespaced: true,
|
||||||
|
state: {
|
||||||
|
socket: null
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
socket: state => {
|
||||||
|
return state.socket;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
SET_SOCKET: (state, socket) => {
|
||||||
|
state.socket = socket;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
setSocket({ commit }, socket) {
|
||||||
|
commit("SET_SOCKET", socket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,25 +1,31 @@
|
|||||||
import Vue from 'vue'
|
import Vue from "vue";
|
||||||
import VueRouter from 'vue-router';
|
import VueRouter from "vue-router";
|
||||||
|
|
||||||
Vue.use(VueRouter)
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
let routes = [
|
let routes = [
|
||||||
{
|
{
|
||||||
name: 'player',
|
name: "player",
|
||||||
path: '/player',
|
path: "/player",
|
||||||
component: (resolve) => require(['./components/player/Player.vue'], resolve)
|
component: resolve => require(["./components/player/Player.vue"], resolve)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'styleguide',
|
name: "styleguide",
|
||||||
path: '/styleguide',
|
path: "/styleguide",
|
||||||
component: (resolve) => require(['./components/Styleguide.vue'], resolve)
|
component: resolve => require(["./components/Styleguide.vue"], resolve)
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'playlist',
|
name: "playlist",
|
||||||
path: '/playlist',
|
path: "/playlist",
|
||||||
component: (resolve) => require(['./components/playlist/Playlist.vue'], resolve)
|
component: resolve =>
|
||||||
|
require(["./components/playlist/Playlist.vue"], resolve)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "channel",
|
||||||
|
path: "/channel",
|
||||||
|
component: resolve => require(["./components/Channel.vue"], resolve)
|
||||||
|
}
|
||||||
// {
|
// {
|
||||||
// name: '404',
|
// name: '404',
|
||||||
// path: '/404',
|
// path: '/404',
|
||||||
@@ -27,11 +33,11 @@ let routes = [
|
|||||||
// }
|
// }
|
||||||
];
|
];
|
||||||
|
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
mode: 'hash',
|
mode: "hash",
|
||||||
base: '/',
|
base: "/",
|
||||||
routes,
|
routes,
|
||||||
linkActiveClass: 'is-active'
|
linkActiveClass: "is-active"
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import Vue from 'vue';
|
import Vue from "vue";
|
||||||
import Vuex from 'vuex';
|
import Vuex from "vuex";
|
||||||
|
|
||||||
import playerModule from '@/modules/playerModule';
|
import playerModule from "@/modules/playerModule";
|
||||||
|
import socketModule from "@/modules/socketModule";
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
|
|
||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
modules: {
|
modules: {
|
||||||
playerModule
|
playerModule,
|
||||||
|
socketModule
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
export default store;
|
export default store;
|
||||||
|
|||||||
Reference in New Issue
Block a user