Answer the question
In order to leave comments, you need to log in
How to declare a vue directive?
There is a 'v-click-outside' plugin that adds a custom directive, I'm trying to connect it
declare module 'vue/types/vue' {
interface Vue {
vClickOutside: () => void;
}
}
import vClickOutside from 'v-click-outside';
Answer the question
In order to leave comments, you need to log in
If you need to extend the existing Vue interface with your own elements, then put a .d.ts file in the project root whose name does not match the other files.
import 'vue'; // нужно чтоб слинковаться с базовыми модулем и интерфейсом
declare module 'vue' { // расширяем модуль
import vClickOutside from 'v-click-outside'; // подключаем типы плагина
interface Vue { // расширяем интерфейс
// прописываем нужные расширения
vClickOutside(): typeof vClickOutside;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question