-
-
Notifications
You must be signed in to change notification settings - Fork 131
Vue 3 support request (Plugin load fail in Vue3) #498
Comments
Hey @tampler . |
@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. |
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? |
Are we abandoning this package for Vue 3? |
To add to what @nizamutdinov was saying, there's also the issue of hook functions for directives being renamed. import { VueMaskDirective } from 'v-mask';
const vMaskV2 = VueMaskDirective;
const vMaskV3 = {
beforeMount: vMaskV2.bind,
updated: vMaskV2.componentUpdated,
unmounted: vMaskV2.unbind
};
createApp(...)
.directive('mask', vMaskV3)
.mount(...); |
Thank you so much! This really helped! |
what about filters tho? Anyway to use it? @dgoldstein89 |
Like @nizamutdinov said:
I haven’t looked into it further. |
While this temporary solution works, how would you go about adding custom placeholders? In vue 2 Edit 1 import {directive, createDirective} from './directive';
import filter from './filter';
import plugin from './plugin';
export {
plugin as default,
plugin as VueMaskPlugin,
filter as VueMaskFilter,
directive as VueMaskDirective,
createDirective
}; The plugin seems to work as before. Just have to be sure to not use the new v-model syntax i.e. "v-model:custom-value" import {createDirective} from "../libraries/v-mask-custom";
export default function install(application) {
const directive = createDirective({
placeholders: {
H: /[0-2]{1}/,
h: /[0-9]{1}/,
M: /[0-5]{1}/,
m: /[0-9]{1}/,
S: /[0-5]{1}/,
s: /[0-9]{1}/
}
});
application.directive("mask", {
beforeMount: directive.bind,
updated: directive.componentUpdated,
unmounted: directive.unbind
});
} Attaching to application. createApp({}).use(VueMaskCustom) |
any news about v-mask for Vue 3? |
Vue 3 release migration checklist:
|
Hello, Any news on the migration? Best Regards. |
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! |
@srsimonson, can you show how to use it, bcs it didn't work for me, thanks |
Hello, Is there any update on Vue3 compatibility? Thank you. |
Hello
I'm new to
Vue
and trying to usev-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
:Error code:
Thanks for supporting this great plugin !
Boris
The text was updated successfully, but these errors were encountered: