1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-25 20:18:28 +09:00
misskey/src/client/app/desktop/views/home/search.vue

77 lines
1.6 KiB
Vue
Raw Normal View History

2018-02-16 17:35:15 +09:00
<template>
<div>
2019-05-21 03:07:11 +09:00
<mk-notes ref="timeline" :pagination="pagination" @inited="inited">
2019-02-18 11:13:56 +09:00
<template #header>
2019-02-18 09:48:00 +09:00
<header class="oxgbmvii">
<span><fa icon="search"/> {{ q }}</span>
</header>
</template>
</mk-notes>
</div>
2018-02-16 17:35:15 +09:00
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
2018-02-16 17:35:15 +09:00
import Progress from '../../../common/scripts/loading';
2019-04-25 07:46:39 +09:00
import { genSearchQuery } from '../../../common/scripts/gen-search-query';
2018-02-16 17:35:15 +09:00
export default Vue.extend({
i18n: i18n('desktop/views/pages/search.vue'),
2018-02-16 17:35:15 +09:00
data() {
return {
2019-05-21 03:07:11 +09:00
pagination: {
endpoint: 'notes/search',
limit: 20,
params: () => genSearchQuery(this, this.q)
}
2018-02-16 17:35:15 +09:00
};
},
computed: {
2018-02-26 00:39:05 +09:00
q(): string {
return this.$route.query.q;
2018-02-16 17:35:15 +09:00
}
},
watch: {
$route() {
this.$refs.timeline.reload();
}
},
2018-02-16 17:35:15 +09:00
mounted() {
document.addEventListener('keydown', this.onDocumentKeydown);
2018-06-07 01:52:03 +09:00
window.addEventListener('scroll', this.onScroll, { passive: true });
Progress.start();
2018-02-16 17:35:15 +09:00
},
beforeDestroy() {
document.removeEventListener('keydown', this.onDocumentKeydown);
window.removeEventListener('scroll', this.onScroll);
},
methods: {
onDocumentKeydown(e) {
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
if (e.which == 84) { // t
(this.$refs.timeline as any).focus();
}
}
},
inited() {
Progress.done();
2018-02-26 00:39:05 +09:00
},
2018-02-16 17:35:15 +09:00
}
});
</script>
<style lang="stylus" scoped>
.oxgbmvii
padding 0 8px
z-index 10
background var(--faceHeader)
box-shadow 0 var(--lineWidth) var(--desktopTimelineHeaderShadow)
2018-02-16 17:35:15 +09:00
> span
padding 0 8px
font-size 0.9em
line-height 42px
color var(--text)
2018-02-16 17:35:15 +09:00
</style>