How can directives be defined and used in Vue3's composition API using the new syntactic sugar in SFC <script setup>
format? In the past, with the options API, it looked something like this:
import click_outside from "@/directives/click-outside.js";
export default {
directives: {
"click-outside": click_outside,
},
...
}
click-outside.js
<script setup>
import {defineProps, onBeforeMount, onUnmounted, directive } from "vue";
const onBeforeMount = (el, binding) => {
...
};
const onUnmounted = (el) => {
...
};
</script>
I'm struggling to find the equivalent code in the composition API