mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-30 18:43:17 +00:00
fix: update search text and title when route changes (#3701)
This commit is contained in:
parent
1ae1688a82
commit
3c177a06ec
@ -152,14 +152,22 @@ export default {
|
||||
return _this.getPreferenceBoolean("searchHistory", false) && localStorage.getItem("search_history");
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
this.updateSearchTextFromURLSearchParams();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.fetchAuthConfig();
|
||||
const query = new URLSearchParams(window.location.search).get("search_query");
|
||||
if (query) this.onSearchTextChange(query);
|
||||
this.updateSearchTextFromURLSearchParams();
|
||||
this.focusOnSearchBar();
|
||||
this.homePagePath = this.getHomePage(this);
|
||||
},
|
||||
methods: {
|
||||
updateSearchTextFromURLSearchParams() {
|
||||
const query = new URLSearchParams(window.location.search).get("search_query");
|
||||
if (query) this.onSearchTextChange(query);
|
||||
},
|
||||
// focus on search bar when Ctrl+k is pressed
|
||||
focusOnSearchBar() {
|
||||
hotkeys("ctrl+k", event => {
|
||||
|
@ -56,6 +56,11 @@ export default {
|
||||
this.updateResults();
|
||||
this.saveQueryToHistory();
|
||||
},
|
||||
updated() {
|
||||
if (this.$route.query.search_query !== undefined) {
|
||||
document.title = this.$route.query.search_query + " - Piped";
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
this.handleRedirect();
|
||||
window.addEventListener("scroll", this.handleScroll);
|
||||
|
Loading…
Reference in New Issue
Block a user