-
Notifications
You must be signed in to change notification settings - Fork 2
/
search.vue
64 lines (55 loc) · 1.3 KB
/
search.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<template>
<b-row>
<b-container>
<b-row>
<b-col>
<b-input-group>
<b-input v-model="query" size="lg" />
<b-input-group-append>
<b-button size="lg">Search</b-button>
</b-input-group-append>
</b-input-group>
</b-col>
</b-row>
<!-- Results -->
<b-row class="mt-3 mt-md-5" v-if="query && results.length">
<druxt-entity
v-for="(result, key) of results"
class="pb-3"
:key="key"
:type="result.type"
:uuid="result.id"
mode="teaser"
:wrapper="{
component: 'b-col',
props: {
class: 'd-flex',
cols: '12',
md: '6',
},
}"
/>
</b-row>
<!-- No results -->
<b-row class="mt-3 mt-md-5" v-else>
<b-col>
<h4>Sorry, no results were found.</h4>
</b-col>
</b-row>
</b-container>
</b-row>
</template>
<script>
import { DruxtSearchMixin } from 'druxt-search'
export default {
name: 'DruxtDemoSearch',
layout: 'search',
mixins: [DruxtSearchMixin],
created() {
if (typeof this.$route.query.query === 'undefined') {
return
}
this.query = this.$route.query.query
},
}
</script>