misskey/src/client/app/mobile/views/pages/featured.vue

62 lines
1.2 KiB
Vue
Raw Normal View History

2019-02-15 06:31:03 +09:00
<template>
<mk-ui>
2019-02-18 11:13:56 +09:00
<template #header><span style="margin-right:4px;"><fa :icon="faNewspaper"/></span>{{ $t('@.featured-notes') }}</template>
2019-02-15 06:31:03 +09:00
<main>
<sequential-entrance animation="entranceFromTop" delay="25">
<template v-for="note in notes">
<mk-note-detail class="post" :note="note" :key="note.id"/>
</template>
</sequential-entrance>
</main>
</mk-ui>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
import Progress from '../../../common/scripts/loading';
import { faNewspaper } from '@fortawesome/free-solid-svg-icons';
export default Vue.extend({
i18n: i18n(''),
data() {
return {
fetching: true,
notes: [],
faNewspaper
};
},
created() {
this.fetch();
},
methods: {
fetch() {
Progress.start();
this.fetching = true;
this.$root.api('notes/featured', {
2019-02-15 15:01:05 +09:00
limit: 20
2019-02-15 06:31:03 +09:00
}).then(notes => {
2019-02-17 00:28:41 +09:00
notes.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
2019-02-15 06:31:03 +09:00
this.notes = notes;
this.fetching = false;
Progress.done();
});
},
}
});
</script>
2019-02-15 08:37:46 +09:00
<style lang="stylus" scoped>
main
> * > .post
margin-bottom 8px
@media (min-width 500px)
> * > .post
margin-bottom 16px
</style>