docs: add prepend option docs for addComponentsDir (#25683)

This commit is contained in:
GJSSSS 2024-02-10 04:34:18 +08:00 committed by GitHub
parent fd671a27ea
commit 0a8a5916aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,7 +17,7 @@ Register a directory to be scanned for components and imported only when used. K
### Type ### Type
```ts ```ts
async function addComponentsDir (dir: ComponentsDir): void async function addComponentsDir (dir: ComponentsDir, opts: { prepend?: boolean } = {}): void
interface ComponentsDir { interface ComponentsDir {
path: string path: string
@ -158,6 +158,16 @@ An object with the following properties:
Transpile specified path using build.transpile. If set to `'auto'`, it will set `transpile: true` if `node_modules/` is in path. Transpile specified path using build.transpile. If set to `'auto'`, it will set `transpile: true` if `node_modules/` is in path.
#### `opts`
**Required**: `false`
- `prepend` (optional)
**Type**: `boolean`
If set to `true`, the directory will be prepended to the array with `unshift()` instead of `push()`.
## `addComponent` ## `addComponent`
Register a component to be automatically imported. Register a component to be automatically imported.