Load search from query
This commit is contained in:
@@ -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()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user