added searchinfos
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<div id="Base">
|
||||
<h1>Base</h1>
|
||||
<h1 class="page-title">{{ pagetitle }}</h1>
|
||||
<aside class="search-info">
|
||||
{{ searchinfos }}
|
||||
</aside>
|
||||
<div class="results">
|
||||
<ul>
|
||||
<li v-for="item in items" v-bind:key="item.nid">
|
||||
@@ -20,9 +23,16 @@ import { mapState, mapActions } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: "Base",
|
||||
data() {
|
||||
return {
|
||||
pagetitle:"Base",
|
||||
// searchinfos: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
items: state => state.Search.items
|
||||
items: state => state.Search.items,
|
||||
searchinfos: state => state.Search.infos
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
@@ -37,6 +47,7 @@ export default {
|
||||
if(params.has('keys') || params.has('term')){
|
||||
this.$store.commit('Search/setKeys', params.get('keys'))
|
||||
this.$store.commit('Search/setTerm', params.get('term'))
|
||||
this.pagetitle = params.get('keys')
|
||||
this.newSearch()
|
||||
}
|
||||
},
|
||||
@@ -45,6 +56,7 @@ export default {
|
||||
console.log('Base beforeRouteUpdate', to, from, next);
|
||||
this.$store.commit('Search/setKeys', to.query.keys)
|
||||
this.$store.commit('Search/setTerm', to.query.term)
|
||||
this.pagetitle = to.query.keys
|
||||
this.newSearch()
|
||||
next()
|
||||
},
|
||||
|
@@ -11,7 +11,9 @@ export default {
|
||||
term: "",
|
||||
items: [],
|
||||
offset: 0,
|
||||
limit: 15
|
||||
limit: 15,
|
||||
infos: null,
|
||||
count: 0
|
||||
},
|
||||
|
||||
// getters
|
||||
@@ -28,6 +30,12 @@ export default {
|
||||
setTerm (state, term) {
|
||||
state.term = term
|
||||
},
|
||||
setInfos (state, infos) {
|
||||
state.infos = infos
|
||||
},
|
||||
setCount (state, count) {
|
||||
state.count = count
|
||||
},
|
||||
resetOffset(state) {
|
||||
state.offset = 0
|
||||
},
|
||||
@@ -56,6 +64,8 @@ export default {
|
||||
.then(({ data }) => {
|
||||
console.log('search MA getresults data', data)
|
||||
commit('setItems', data.items)
|
||||
commit('setInfos', data.infos)
|
||||
commit('setCount', data.count)
|
||||
})
|
||||
.catch(( error ) => {
|
||||
console.warn('Issue with getResults', error)
|
||||
|
Reference in New Issue
Block a user