summaryrefslogtreecommitdiff
path: root/src/client/app/common/views/deck/deck.search-column.vue
blob: a2d1142fbe1c9bc470246d4bc19204088f33e504 (plain)
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
<template>
<x-column>
	<template #header>
		<fa icon="search"/><span>{{ q }}</span>
	</template>

	<div>
		<x-notes ref="timeline" :pagination="pagination" @inited="() => $emit('loaded')"/>
	</div>
</x-column>
</template>

<script lang="ts">
import Vue from 'vue';
import XColumn from './deck.column.vue';
import XNotes from './deck.notes.vue';
import { genSearchQuery } from '../../../common/scripts/gen-search-query';

export default Vue.extend({
	components: {
		XColumn,
		XNotes
	},

	data() {
		return {
			pagination: {
				endpoint: 'notes/search',
				limit: 20,
				params: () => genSearchQuery(this, this.q)
			}
		};
	},

	computed: {
		q(): string {
			return this.$route.query.q;
		}
	},

	watch: {
		$route() {
			this.$refs.timeline.reload();
		}
	},
});
</script>