Skip to content

Commit

Permalink
chore: adjust the document preview file order
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Sep 14, 2024
1 parent 2e79695 commit 3a582b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/.vitepress/config/plugins/demo-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ export const demoPreviewPlugin = (md: MarkdownRenderer) => {
if (!state.tokens[index]) {
return '';
}

const firstString = 'index.vue';
childFiles = childFiles.sort((a, b) => {
if (a === firstString) return -1;
if (b === firstString) return 1;
return a.localeCompare(b, 'en', { sensitivity: 'base' });
});
state.tokens[index].content =
`<DemoPreview files="${encodeURIComponent(JSON.stringify(childFiles))}" ><${ComponentName}/>
`;
Expand Down

0 comments on commit 3a582b9

Please sign in to comment.