Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 10, 2023
1 parent 8096add commit 5cb723d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/content/1.guide/2.composables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Composables

In case you might want to open or control the Nuxt DevTools in your application on development, a composable `useNuxtDevtools` is registered with auto-import.

```vue
<script setup>
// Returns undefined in production mode or when the DevTools are not enabled
const devtoolsClient = useNuxtDevtools() // NuxtDevToolsHostClient | undefined
</script>
<template>
<button
v-if="devtoolsClient"
@click="devtoolsClient.devtools.navigate('/modules/components')"
>
<!-- Open the DevTools and navigate to the components tab -->
Open DevTools
</button>
</template>
```

When you have auto-import disabled, you can also import it explicitly:

```ts
import { useNuxtDevtools } from '#imports'
```

Checkout it's type definition for more available methods.

0 comments on commit 5cb723d

Please sign in to comment.