v-mask: Vue 3 support request (Plugin load fail in Vue3)
Hello
I’m new to Vue and trying to use v-mask in my project. I was following the blog post, but the plugin fails on load.
System OS: Ubuntu 18.04 npm: 6.14.8 node: 14.12.0 browser: Chromium 85.0.4183.83
Loading with main.js:
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
createApp(App).use(store).use(router).mount('#app')
Error code:
v-mask.esm.js?b6d0:501 Uncaught TypeError: Vue.filter is not a function
at plugin (v-mask.esm.js?b6d0:501)
at Object.use (runtime-core.esm-bundler.js?5c40:3364)
at eval (main.js?56d7:6)
at Module../src/main.js (app.js:1129)
at __webpack_require__ (app.js:849)
at fn (app.js:151)
at Object.1 (app.js:1142)
at __webpack_require__ (app.js:849)
at checkDeferredModules (app.js:46)
at app.js:925
Thanks for supporting this great plugin !
Boris
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 6
- Comments: 16 (2 by maintainers)
To add to what @nizamutdinov was saying, there’s also the issue of hook functions for directives being renamed. The following should work to use as a directive in Vue 3:
Hello,
Any news on the migration?
Best Regards. JB
Vue Core 3.0 has been released a couple of months ago, with full ‘latest’ tagged release with all the official packages maturing as stable, aimed at the end of the year.
@probil as there is less than a month of time left, have you been planning for this upgrade?
Vue 3 release migration checklist:
computed+ tests@vue/test-utilsupgrade to v2)Are we abandoning this package for Vue 3?
@probil Hey
VUE 3.0 requires two major changes:
1. Directives are now declared differently.
2. “Filters” have been removed. Instead, it is suggested to use “computed” properties.
After making these changes, the directives works as before.
But still, the filter needs to be replaced with a computed property.
Hope it helps.
https://www.npmjs.com/package/maska
I was able to replace v-mask with maska. I didn’t even have to change my masking conventions, it was literally a 1:1 swap, app.use(Maska) then added an “a” at the and of all references to v-mask to make v-maska and that was it.
I doubt everyone will have such a seamless transition, but Maska is worth a shot!
any news about v-mask for Vue 3? thank you
Hey @tampler .
v-maskdoesn’t support Vue 3 yet. Since Vue 3 has been released recently I suppose it’s time to make library compatible with it. Thanks for the issue@dgoldstein89 https://v3.vuejs.org/guide/migration/filters.html#global-filters
Thank you so much! This really helped!