wip: refactor(client): migrate paging components to composition api

This commit is contained in:
syuilo
2022-01-13 02:21:43 +09:00
parent 25f15677c3
commit f96d50bc07
5 changed files with 92 additions and 111 deletions

View File

@@ -6,31 +6,31 @@
</div>
</template>
<script lang="ts">
import { computed, defineComponent } from 'vue';
<script lang="ts" setup>
import { computed } from 'vue';
import XNotes from '@/components/notes.vue';
import * as symbols from '@/symbols';
import { i18n } from '@/i18n';
export default defineComponent({
components: {
XNotes
},
const props = defineProps<{
query: string;
channel?: string;
}>();
data() {
return {
[symbols.PAGE_INFO]: {
title: computed(() => this.$t('searchWith', { q: this.$route.query.q })),
icon: 'fas fa-search',
},
pagination: {
endpoint: 'notes/search',
limit: 10,
params: computed(() => ({
query: this.$route.query.q,
channelId: this.$route.query.channel,
}))
},
};
},
const pagination = {
endpoint: 'notes/search',
limit: 10,
params: computed(() => ({
query: props.query,
channelId: props.channel,
}))
};
defineExpose({
[symbols.PAGE_INFO]: computed(() => ({
title: i18n.t('searchWith', { q: props.query }),
icon: 'fas fa-search',
bg: 'var(--bg)',
})),
});
</script>