feat: working SPA
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onBeforeMount } from 'vue'
|
||||
import { listArticles } from '@/lib/articles'
|
||||
import type { MarkdownAttributes } from '@/interfaces'
|
||||
|
||||
const articles = ref<MarkdownAttributes[]>([])
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const newArticles = await listArticles()
|
||||
console.log(newArticles)
|
||||
articles.value.splice(0, articles.value.length, ...newArticles)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>Home View</h1>
|
||||
<div v-for="(attr, index) in articles" v-bind:key="index">
|
||||
<RouterLink :to="attr.path ?? ''">{{ attr.title }}</RouterLink>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
Reference in New Issue
Block a user