Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

prevent mask when a falsey value is assigned to v-mask #444

Closed

Conversation

johndugan
Copy link

@johndugan johndugan commented Aug 13, 2019

I have a json object of form data that I iterate over with v-for in my template. Not all of the fields within that object have/require an input mask. For those fields that do not, I was getting errors because no mask value was passed to the v-mask directive.

Form Component (partially)

<div
    v-for="field in fields"
    :key="field.id"
    class="Form"
>
    <BaseInput
        :id="field.id"
        :value="order[field.id]"
        :placeholder="field.placeholder"
        :mask="field.mask"
        :datalist="field.datalist"
        :label="field.label"
        :validator="field.validator"
        @input="editField"
    >
        {{ field.message }}
    </BaseInput>
</div>

BaseInput Component (partially)

<input
    :id="id"
    v-mask="mask"
    type="text"
    :value="value"
    v-bind="$attrs"
    :required="isRequired"
    :list="datalistId"
    class="Form_fieldInput"
    v-on="$listeners"
    @focus="onFocus"
    @blur="onBlur"
/>

@probil
Copy link
Owner

probil commented Aug 22, 2019

Hi @johndugan 👋
Looks good but PR should not contain changes in dist
https://github.com/probil/v-mask#beers-contributing

I will add tests and merge it to develop soon. Thanks for your contribution!

@probil probil closed this in dda537c Jul 21, 2020
@github-actions
Copy link

🎉 This issue has been resolved in version 2.2.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants