You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To ensure proper rendering of the tree structure, you need to configure the Vue compiler to preserve whitespace. Update your `vite.config.ts` as follows:
18
+
19
+
```ts
20
+
// https://vite.dev/config/
21
+
exportdefaultdefineConfig({
22
+
// ...
23
+
plugins: [vue(
24
+
{
25
+
template: {
26
+
compilerOptions: {
27
+
whitespace: "preserve",
28
+
},
29
+
}
30
+
}
31
+
)],
32
+
})
33
+
```
34
+
35
+
## Code
36
+
You can locally register the `VueTree` component in your Vue file:
37
+
38
+
```vue
39
+
<script setup lang="ts">
40
+
import { VueTree } from '@tlylt/vue-tree'
41
+
import '@tlylt/vue-tree/style.css'
42
+
</script>
43
+
44
+
<template>
45
+
<VueTree>
46
+
C:/course/
47
+
textbook/
48
+
index.md
49
+
index.md
50
+
reading.md
51
+
site.json
52
+
</VueTree>
53
+
</template>
54
+
```
55
+
56
+
Alternatively, you can register the `VueTree` component globally in your `main.ts`:
57
+
58
+
```ts
59
+
import { createApp } from'vue';
60
+
importAppfrom'./App.vue';
61
+
import { VueTree } from'@tlylt/vue-tree';
62
+
import'@tlylt/vue-tree/style.css'; // Import the styles
0 commit comments