Skip to content

Commit 8ea2e64

Browse files
committed
update readme
1 parent 0aeb36f commit 8ea2e64

File tree

2 files changed

+112
-18
lines changed

2 files changed

+112
-18
lines changed

README.md

+109-15
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,122 @@
11
# Vue Tree
22

3-
A simple Vue component to beautify tree-like visualization.
3+
A simple Vue component to beautify tree-like visualizations.
44

5-
Important note:
6-
User of this component must have `whitespace: 'preserve'` defined in the vue compilerOptions.
5+
## Features
6+
- Render tree-like structures in a visually appealing way.
7+
- Fully customizable and lightweight.
8+
- Supports scoped styles for seamless integration.
9+
10+
## Installation
11+
12+
Install the package via npm:
13+
14+
```bash
15+
npm install @tlylt/vue-tree
16+
```
17+
18+
or yarn:
19+
20+
```bash
21+
yarn add @tlylt/vue-tree
22+
```
23+
24+
## Usage
25+
26+
### Basic Usage
27+
28+
Import and register the component in your Vue application:
29+
30+
```ts
31+
import { createApp } from 'vue';
32+
import App from './App.vue';
33+
import { VueTree } from '@tlylt/vue-tree';
34+
35+
const app = createApp(App);
36+
app.use(VueTree);
37+
app.mount('#app');
38+
```
39+
40+
### Example
41+
42+
Use indentation (2 spaces) to indicate the level of nesting:
43+
```vue
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+
Expected:
57+
```
58+
C:/course/
59+
├── textbook/
60+
│ └── index.md
61+
├── index.md
62+
├── reading.md
63+
└── site.json
64+
```
65+
66+
67+
68+
## Important Notes
69+
70+
To use this component, you must configure `whitespace: 'preserve'` in the Vue compiler options. This ensures that the tree structure is rendered correctly.
71+
72+
### Vite Configuration
73+
74+
Add the following to your `vite.config.ts`:
775

8-
vite.config.ts
976
```ts
10-
plugins: [vue(
11-
{
12-
template: {
13-
compilerOptions: {
14-
whitespace: "preserve",
15-
},
16-
}
77+
plugins: [vue(
78+
{
79+
template: {
80+
compilerOptions: {
81+
whitespace: "preserve",
82+
},
1783
}
18-
)],
84+
}
85+
)],
1986
```
2087

21-
within ts/js
88+
### Vue Configuration
89+
90+
If you are using Vue programmatically, configure the compiler options as follows:
91+
2292
```js
2393
const app = Vue.createApp({
2494
compilerOptions: {
2595
whitespace: 'preserve'
2696
}
27-
})
28-
```
97+
});
98+
```
99+
100+
### Props
101+
WIP
102+
103+
Add details about the props supported by the component.
104+
105+
### Events
106+
WIP
107+
108+
Document any events emitted by the component.
109+
110+
### Slots
111+
WIP
112+
113+
Explain the slots available for customization.
114+
115+
### Customization
116+
WIP
117+
118+
Provide details on how to customize the component, such as styles or additional options.
119+
120+
## License
121+
122+
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.

docs/api-examples.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ outline: deep
44

55
<VueTree>
66
C:/course/
7-
textbook/
8-
index.md
7+
textbook/
98
index.md
9+
index.md
1010
reading.md
11-
site.json
11+
site.json
1212
</VueTree>
1313

1414
# Runtime API Examples

0 commit comments

Comments
 (0)