Skip to content

Commit

Permalink
docs: updated v-hover documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cnouguier committed Oct 6, 2024
1 parent a655f6d commit 85c44c8
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions docs/api/core/directives.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Directives

::: tip
The **Directives** provided by the **KDK** must be registered by each application within the corresponding `kdk.js` [boot file](https://quasar.dev/quasar-cli-vite/boot-files#anatomy-of-a-boot-file).
The **Directives** provided by the **KDK** must be registered by each application within the corresponding `kdk.js` [boot file](https://quasar.dev/quasar-cli-vite/boot-files#anatomy-of-a-boot-file). For instance:

```js
// Register global directives
app.directive('hover', kdkCoreDirectives.vHover)
Expand All @@ -12,8 +13,26 @@ app.directive('hover', kdkCoreDirectives.vHover)

`v-hover` is a lightweight directive that allows you to react when an element either becomes hovered or unhovered.

Here is an example of use:

```html
<div v-hover="{ enter: enterCallback, leave: leaveCallback }">
....
</div>
```

<script setup>
importref } from 'vue'
import { directives as kdkCoreDirectives } from '@kalisio/kdk/core.client'
// Data
const isHover = ref(false)
// Functions
function enterCallback (event) {
isHover.value = true
}
function leaveCallback (event) {
isHover.value = false
}
</script>
```

0 comments on commit 85c44c8

Please sign in to comment.