mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-02 09:59:55 +08:00
feat(docs): migrate bs docs
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { useRoute } from 'vitepress';
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { data as posts } from './posts.data';
|
||||
|
||||
export function usePosts() {
|
||||
const route = useRoute();
|
||||
const path = route.path;
|
||||
|
||||
function findCurrentIndex() {
|
||||
const result = posts.findIndex(p => p.url === route.path);
|
||||
if (result === -1) console.error(`blog post missing: ${route.path}`);
|
||||
return result;
|
||||
}
|
||||
|
||||
const post = computed(() => posts[findCurrentIndex()]);
|
||||
|
||||
return { posts, post, path };
|
||||
}
|
||||
Reference in New Issue
Block a user