base_ui/components/other/post-list.vue

37 lines
540 B
Vue
Raw Normal View History

2025-02-01 09:34:55 +00:00
<script>
export default {
provide() {
return {
posts: this.posts,
};
},
mounted() {
getPosts().then((res) => {
this.posts = res;
this.loading = false;
});
},
data() {
return {
posts: [],
loading: false,
};
},
methods: {},
};
</script>
<template>
<div v-if="loading">
<NuxtLoadingIndicator />
<h1>Loading...</h1>
</div>
<div v-else>
{{ posts?.length ?? 0 }}
<ul>
<post-list-item :posts="posts"></post-list-item>
</ul>
</div>
</template>