Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Jan 14, 2023
1 parent 3c958f8 commit ce1cea5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 44 deletions.
13 changes: 6 additions & 7 deletions docs/components/ModalDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ const showModal = ref(false)
</script>

<template>
<button class="modal-button" @click="showModal = true">
Show Modal
</button>
<button class="modal-button" @click="showModal = true">Show Modal</button>

<teleport to="body">
<transition name="modal">
<Teleport to="body">
<Transition name="modal">
<div v-show="showModal" class="modal-mask">
<div class="modal-container">
<p>Hello from the modal!</p>
Expand All @@ -20,8 +18,8 @@ const showModal = ref(false)
</div>
</div>
</div>
</transition>
</teleport>
</Transition>
</Teleport>
</template>

<style scoped>
Expand Down Expand Up @@ -72,6 +70,7 @@ const showModal = ref(false)
.modal-leave-to {
opacity: 0;
}
.modal-enter-from .modal-container,
.modal-leave-to .modal-container {
transform: scale(1.1);
Expand Down
76 changes: 39 additions & 37 deletions docs/config/app-configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,47 @@ VitePress build hooks allow you to add new functionality and behaviors to your w
- Sitemap
- Search Indexing
- PWA
- Teleports

### buildEnd

- Type: `(siteConfig: SiteConfig) => Awaitable<void>`

`buildEnd` is a build CLI hook, it will run after build (SSG) finish but before VitePress CLI process exits.

```ts
export default {
async buildEnd(siteConfig) {
// ...
}
}
```

### postRender

- Type: `(context: SSGContext) => Awaitable<SSGContext | void>`

`postRender` is a build hook, called when SSG rendering is done. It will allow you to handle the teleports content during SSG.

```ts
export default {
async postRender(context) {
// ...
}
}
```

```ts
interface SSGContext {
content: string
teleports?: Record<string, string>
[key: string]: any
}
```

### transformHead

- Type: `(ctx: TransformContext) => Awaitable<HeadConfig[]>`
- Type: `(context: TransformContext) => Awaitable<HeadConfig[]>`

`transformHead` is a build hook to transform the head before generating each page. It will allow you to add head entries that cannot be statically added to your VitePress config. You only need to return extra entries, they will be merged automatically with the existing ones.

Expand All @@ -311,7 +348,7 @@ Don't mutate anything inside the `ctx`.

```ts
export default {
async transformHead(ctx) {
async transformHead(context) {
// ...
}
}
Expand Down Expand Up @@ -367,38 +404,3 @@ export default {
}
}
```

### rendered

- Type: `(context: SSGContext) => Awaitable<SSGContext | void>`

`rendered` is a build hook, called when SSG rendering is done. It will allow you to handling the teleports content during SSG.

```ts
export default {
async rendered(context) {
}
}
```

```ts
interface SSGContext {
content: string
teleports?: Record<string, string>
[key: string]: any
}
```

### buildEnd

- Type: `(siteConfig: SiteConfig) => Awaitable<void>`

`buildEnd` is a build CLI hook, it will run after build (SSG) finish but before VitePress CLI process exits.

```ts
export default {
async buildEnd(siteConfig) {
// ...
}
}
```

0 comments on commit ce1cea5

Please sign in to comment.