Answer the question
In order to leave comments, you need to log in
Failed to resolve directive. Why is the local directive not being set?
<template lang="pug">
button.btn
slot
</template>
<script>
export default {
directives: {
light: { bind () { console.log('test') } }
}
}
</script>
<template lang="pug">
ui-button(v-light) Button
</template>
<script>
import UiButton from '~components/ui/button.vue'
export default {
components: { UiButton }
}
</script>
Answer the question
In order to leave comments, you need to log in
Everything is correct. It doesn't work because the directive must be specified in the second piece of the block, where you use the directive itself.
To solve the problem, either put the directive in a separate file and include it in the entry file, or use it in the button component.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question