first display of search results
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
<template>
|
||||||
|
<article class="result item">
|
||||||
|
<header>
|
||||||
|
<h1>
|
||||||
|
<a
|
||||||
|
:href="result.url"
|
||||||
|
@click.prevent="onclick"
|
||||||
|
@keyup.enter="onclick"
|
||||||
|
v-html="result.textId"
|
||||||
|
/>
|
||||||
|
</h1>
|
||||||
|
</header>
|
||||||
|
<div class="extract" v-html="result.extract" />
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'ResultItem',
|
||||||
|
props: {
|
||||||
|
result: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: () => ({
|
||||||
|
|
||||||
|
}),
|
||||||
|
methods: {
|
||||||
|
onclick () {
|
||||||
|
console.log('clicked on result item', this.result)
|
||||||
|
// this.$router.push({
|
||||||
|
// name:`article`,
|
||||||
|
// params: { alias:this.alias },
|
||||||
|
// query: { uuid: this.item.uuid }
|
||||||
|
// // meta: { uuid:this.item.uuid },
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
@@ -1,15 +1,39 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="results">
|
<div id="results">
|
||||||
Results
|
<h2>Resultats</h2>
|
||||||
|
<h3>{{ keys }}</h3>
|
||||||
|
<div class="results-list">
|
||||||
|
<ul v-if="results.length">
|
||||||
|
<li v-for="result in results" :key="result.uuid">
|
||||||
|
<ResultItem :result="result" />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
import ResultItem from '../Content/ResultItem'
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Results',
|
name: 'Results',
|
||||||
|
components: {
|
||||||
|
ResultItem
|
||||||
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
|
||||||
})
|
}),
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
keys: state => state.Search.keys,
|
||||||
|
results: state => state.Search.results
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default {
|
|||||||
return REST.get(`/search?` + q)
|
return REST.get(`/search?` + q)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log('search REST: data', data)
|
console.log('search REST: data', data)
|
||||||
// commit('setResults', data.content)
|
commit('setResults', data.content)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with search', error)
|
console.warn('Issue with search', error)
|
||||||
|
|||||||
Reference in New Issue
Block a user