Load search from query
This commit is contained in:
@@ -32,12 +32,21 @@ export default {
|
|||||||
const searchParams = new URLSearchParams()
|
const searchParams = new URLSearchParams()
|
||||||
if (isNotEmpty(titles))
|
if (isNotEmpty(titles))
|
||||||
searchParams.append('keywords', titles)
|
searchParams.append('keywords', titles)
|
||||||
if (isNotEmpty(tags))
|
if (isNotEmpty(tags))
|
||||||
searchParams.append('tags', R.map(this.removeFirstChar, tags))
|
searchParams.append('tags', R.map(this.removeFirstChar, tags))
|
||||||
|
|
||||||
this.$router.push(this.searchPath + '?' + searchParams.toString())
|
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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,13 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.showTitle = true
|
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: {
|
methods: {
|
||||||
async createCopyUrl(resource) {
|
async createCopyUrl(resource) {
|
||||||
|
|||||||
Reference in New Issue
Block a user