diff --git a/components/Search.vue b/components/Search.vue index 5bc4360..21abe33 100644 --- a/components/Search.vue +++ b/components/Search.vue @@ -32,12 +32,21 @@ export default { const searchParams = new URLSearchParams() if (isNotEmpty(titles)) searchParams.append('keywords', titles) - if (isNotEmpty(tags)) + if (isNotEmpty(tags)) searchParams.append('tags', R.map(this.removeFirstChar, tags)) - + this.$router.push(this.searchPath + '?' + searchParams.toString()) }, }, + mounted() { + let keywords = this.$route.query.keywords || '' + keywords = keywords.split(',').join(' ') + + let tags = this.$route.query.tags || '' + tags = R.filter(this.isTag, tags.split(',')).map(tag => `#${tag}`).join(' ') + + this.searchInput = `${tags} ${keywords}`.trim() + }, } diff --git a/pages/search.vue b/pages/search.vue index c3b34aa..b9bdc2e 100644 --- a/pages/search.vue +++ b/pages/search.vue @@ -56,6 +56,13 @@ export default { }, mounted() { this.showTitle = true + + const keywords = this.$route.query.keywords + const tags = this.$route.query.tags + this.searchInput = { + keywords: keywords && R.split(',', keywords), + tags: tags && R.split(',', tags), + } }, methods: { async createCopyUrl(resource) {