mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
Save the tab param to the URL at runtime
This commit is contained in:
parent
d7ba61ebbc
commit
7f72485a04
2 changed files with 15 additions and 0 deletions
|
@ -224,10 +224,13 @@ export default {
|
||||||
},
|
},
|
||||||
loadTab(index) {
|
loadTab(index) {
|
||||||
this.selectedTab = index;
|
this.selectedTab = index;
|
||||||
|
this.appendQueryToUrl("tab", this.tabs[index].name ?? "videos");
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
this.contentItems = this.channel.relatedStreams;
|
this.contentItems = this.channel.relatedStreams;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tabs[index].content) {
|
if (this.tabs[index].content) {
|
||||||
this.contentItems = this.tabs[index].content;
|
this.contentItems = this.tabs[index].content;
|
||||||
return;
|
return;
|
||||||
|
|
12
src/main.js
12
src/main.js
|
@ -251,6 +251,18 @@ const mixin = {
|
||||||
elem.click();
|
elem.click();
|
||||||
elem.remove();
|
elem.remove();
|
||||||
},
|
},
|
||||||
|
appendQueryToUrl(key, value) {
|
||||||
|
let searchParams = new URLSearchParams(window.location.search);
|
||||||
|
searchParams.set(key, value);
|
||||||
|
let newurl =
|
||||||
|
window.location.protocol +
|
||||||
|
"//" +
|
||||||
|
window.location.host +
|
||||||
|
window.location.pathname +
|
||||||
|
"?" +
|
||||||
|
searchParams.toString();
|
||||||
|
window.history.pushState({ path: newurl }, "", newurl);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
authenticated(_this) {
|
authenticated(_this) {
|
||||||
|
|
Loading…
Reference in a new issue