Skip to content

Prop Validation Returns Error if Empty String #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DinsmoreDesign opened this issue May 7, 2018 · 3 comments
Closed

Prop Validation Returns Error if Empty String #15

DinsmoreDesign opened this issue May 7, 2018 · 3 comments
Assignees

Comments

@DinsmoreDesign
Copy link

Hey guys,

Loving the functionality of this library so far, but my only real issue so far is that if I try to pass an empty string (""), I get the following error:

image

As far as I can tell, it's necessary to pass an empty string into the component for it to show the Placeholder value. The component still works as intended after I enter a number, but I'm not too fond of seeing a giant red warning on my console, when it's really not an issue that I can see. Can we add prop validation for a String as well, so an empty value can be passed, or is there a better way to do this?

Thanks!

@AlexandreBonneau AlexandreBonneau self-assigned this May 8, 2018
@AlexandreBonneau
Copy link
Member

Hey @DinsmoreDesign, I've added some tests in the examples-src/App.vue file to see if I can reproduce this error:

  • when initializing the component with an empty v-model ''
  • when using the AutoNumeric clear(true) method of the component
  • when using the AutoNumeric set('') method of the component

but couldn't see that message you described, which is odd since I explicitly pass the empty string to the component and I should see that too.

Would you have a reproducible test case?

@DinsmoreDesign
Copy link
Author

@AlexandreBonneau Hmm... oddly enough, I can't seem to get this to replicate on the Codepen example. I'm using the module system in my app.

I can't seem to get your project to run properly, but copying and pasting your example into my own project, it still reproduces the console error for me:

https://github.com/DinsmoreDesign/Vue-AutoNumeric-Test

@AlexandreBonneau
Copy link
Member

Ok, I fixed the bug, and am going to push it with other fixes in the next couple hours.

For info, you will be able to check that it works with your test project, but you will need to modify your webpack configuration to add the following alias:

resolve: {
  alias: {
    'vue$': 'vue/dist/vue.esm.js',
    AutoNumeric: 'autonumeric/dist/autoNumeric.min', // The new line to add
  },
  extensions: ['*', '.js', '.vue', '.json']
},

If you don't, the build will still work, but you'll get an error from uglifyjs.

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

No branches or pull requests

2 participants