Can I override VueJS built-in directive?

90 views Asked by At

I want to add an important modifier to the v-show directive. I copied it's code and added the modifier.

Can I somehow override the built-in v-show directive? I tried:

import { vShow } from "@/directives/vShow"
...
const app = createApp(App).
    directive("show", vShow)
    ...
    mount("#app")

but it doesn't work. Vue still uses the built-in one. It works if I register it as a new directive (v-cshow):

const app = createApp(App).
    directive("cshow", vShow).
    ...
    mount("#app")
0

There are 0 answers