-
Notifications
You must be signed in to change notification settings - Fork 4
/
search-results.vue
39 lines (36 loc) · 1.2 KB
/
search-results.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<style scoped>
.collection {
position: absolute;
width: 100%;
z-index: 2;
margin-top: 0;
border: none;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
}
</style>
<template>
<div class="collection" v-if="$store.state.search.searchResults.length && $store.state.search.query">
<router-link :to="article.slug"
v-on:click.native="clearSearch"
class="collection-item"
v-for="article in $store.state.search.searchResults"
:key="article.slug"
>
<span>{{ article.title }}</span>
</router-link>
</div>
<ul class="collection" v-else-if="!$store.state.search.searchResults.length && $store.state.search.query != ''">
<li class="collection-item">{{ $store.bootstrap.localizations.no_result }}</li>
</ul>
</template>
<script type="text/babel">
export default {
props: ['q'],
methods: {
clearSearch() {
this.$emit('update:q', "")
this.$store.dispatch('search/resetSearch')
}
}
}
</script>