How to use directives in Vue 3 Web Component library?
What problem does this feature solve?
This feature would somehow allow vue components which have no app instance to install directives.
We are building a Vue 3 Web Component library. We don't create an app, instead we just export our components individually. We would like to be able to install directives, but it requires an app as input.
What I've done as a work around is:
import { createApp, Directive } from 'vue';
import VWave from 'v-wave';
const app = createApp({});
app.use(VWave);
export const Wave: Directive = {
...app._context.directives.wave
}
What does the proposed API look like?
Vue.directive('name': string, directive: Directive);