From e588d238af7c8ca120126cbc655683693b7284ae Mon Sep 17 00:00:00 2001 From: Jarsen Date: Tue, 31 May 2022 21:33:14 +0800 Subject: [PATCH 1/3] fix: remove search query from url when empty --- components/rmrk/Gallery/Search/SearchBar.vue | 5 +++-- components/rmrk/Gallery/Search/SearchBarCollection.vue | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/rmrk/Gallery/Search/SearchBar.vue b/components/rmrk/Gallery/Search/SearchBar.vue index 007c416050..6e483909d1 100644 --- a/components/rmrk/Gallery/Search/SearchBar.vue +++ b/components/rmrk/Gallery/Search/SearchBar.vue @@ -295,6 +295,7 @@ export default class SearchBar extends mixins( } public mounted(): void { + console.log('jarsen this.', this) this.getSearchHistory() exist(this.$route.query.search, this.updateSearch) exist(this.$route.query.min, this.updatePriceMin) @@ -340,7 +341,7 @@ export default class SearchBar extends mixins( } get searchQuery(): string { - return this.search + return this.search || '' } set searchQuery(value: string) { @@ -663,7 +664,7 @@ export default class SearchBar extends mixins( query: { page: '1', ...this.$route.query, - search: this.searchQuery, + search: this.searchQuery || undefined, [key]: value, [key2]: value2, }, diff --git a/components/rmrk/Gallery/Search/SearchBarCollection.vue b/components/rmrk/Gallery/Search/SearchBarCollection.vue index a540599a89..d74e5d602b 100644 --- a/components/rmrk/Gallery/Search/SearchBarCollection.vue +++ b/components/rmrk/Gallery/Search/SearchBarCollection.vue @@ -183,7 +183,7 @@ export default class SearchBar extends mixins(KeyboardEventsMixin) { path: String(this.$route.path), query: { ...this.$route.query, - search: this.searchQuery, + search: this.searchQuery || undefined, [key]: value, }, }) From 39b6f85774338b1d7fe8c35779b0e56749af57cd Mon Sep 17 00:00:00 2001 From: Jarsen Date: Tue, 31 May 2022 21:39:22 +0800 Subject: [PATCH 2/3] remove log --- components/rmrk/Gallery/Search/SearchBar.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/components/rmrk/Gallery/Search/SearchBar.vue b/components/rmrk/Gallery/Search/SearchBar.vue index 6e483909d1..341f468b56 100644 --- a/components/rmrk/Gallery/Search/SearchBar.vue +++ b/components/rmrk/Gallery/Search/SearchBar.vue @@ -295,7 +295,6 @@ export default class SearchBar extends mixins( } public mounted(): void { - console.log('jarsen this.', this) this.getSearchHistory() exist(this.$route.query.search, this.updateSearch) exist(this.$route.query.min, this.updatePriceMin) From c76dfd5e793d0973027c2a70781a619390c7aa47 Mon Sep 17 00:00:00 2001 From: Jarsen Date: Tue, 31 May 2022 21:39:22 +0800 Subject: [PATCH 3/3] remove log --- components/rmrk/Gallery/Search/SearchBar.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/rmrk/Gallery/Search/SearchBar.vue b/components/rmrk/Gallery/Search/SearchBar.vue index 6e483909d1..0e3fc658fd 100644 --- a/components/rmrk/Gallery/Search/SearchBar.vue +++ b/components/rmrk/Gallery/Search/SearchBar.vue @@ -295,7 +295,6 @@ export default class SearchBar extends mixins( } public mounted(): void { - console.log('jarsen this.', this) this.getSearchHistory() exist(this.$route.query.search, this.updateSearch) exist(this.$route.query.min, this.updatePriceMin) @@ -341,7 +340,7 @@ export default class SearchBar extends mixins( } get searchQuery(): string { - return this.search || '' + return this.search } set searchQuery(value: string) {