vue-the-mask icon indicating copy to clipboard operation
vue-the-mask copied to clipboard

Does not works in VUE 3 + Server Sider Rendering

Open murilolivorato opened this issue 3 years ago • 5 comments

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 avatar Dec 12 '21 01:12 murilolivorato

nobody can help me ? =/

murilolivorato avatar Jan 07 '22 20:01 murilolivorato

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

murilolivorato avatar Feb 22 '22 22:02 murilolivorato

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

Unfortunatelly this package has been abandoned by its creator :/

joao-pedro-alves avatar May 02 '22 22:05 joao-pedro-alves

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

ilyaDegtyarenko avatar Jun 23 '22 14:06 ilyaDegtyarenko

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

abdurrahmanseyidoglu avatar Dec 05 '23 09:12 abdurrahmanseyidoglu