vuejs-tips / vue-the-mask

Tiny (<2k gzipped) and dependency free mask input for Vue.js
https://vuejs-tips.github.io/vue-the-mask/
1.72k stars 212 forks source link

Does not works in VUE 3 + Server Sider Rendering #184

Open murilolivorato opened 2 years ago

murilolivorato commented 2 years ago

Hello , in VUE 3 , use components like this, will not work - <the-mask :mask="['###.###.###-##', '##.###.###/####-##']" />

I need to use directives , like this -

<input v-mask="['###.###.###-##', '##.###.###/####-##']" />

The problem is that I am working with SSR + VUE 3 , and it will not work . Working with directives with vue 3 + SSR . it will give me erros .

It is that possible to work with components in vue 3 ?

murilolivorato commented 2 years ago

nobody can help me ? =/

murilolivorato commented 2 years ago

it does not works for vue 3 + SSR . =/ no answer

joao-pedro-alves commented 2 years ago

it does not works for vue 3 + SSR . =/ no answer

Unfortunatelly this package has been abandoned by its creator :/

ilyaDegtyarenko commented 2 years ago

Try this https://github.com/uNmAnNeR/imaskjs/tree/master/packages/vue-imask

abdurrahmanseyidoglu commented 9 months ago

You can detect if the window object is available (Which means we are on the client side) and render the input accordingly like This:

<template>
  <div v-if="isBrowser">
    <input v-mask="['###.###.###-##', '##.###.###/####-##']" />
  </div>
</template>

<script setup>
import { ref } from 'vue';

const isBrowser = ref(typeof window !== 'undefined');
</script>

Have a look at this as well: https://vuejs.org/guide/scaling-up/ssr.html#access-to-platform-specific-apis