JosephusPaye / Keen-UI

A lightweight Vue.js UI library with a simple API, inspired by Google's Material Design.
https://josephuspaye.github.io/Keen-UI/
MIT License
4.1k stars 440 forks source link

Textbox step prop expected to be String #460

Closed hyvyys closed 4 years ago

hyvyys commented 4 years ago

With this code

<UiTextbox
    type="number"
    :value="fontSize"
    :min="minFontSize"
    :max="maxFontSize"
    :step="fontSizeStep"
    @input="v => $emit('update:fontSize', parseInt(v))"
/>

I get Invalid prop: type check failed for prop "step". Expected String with value "1", got Number with value 1. I believe the expected prop type should be Number.

On a sidenote, it would be worth having a separate UiNumber component. I'm kind of in the beginning of creating one by extending UiTextbox, I'll see if it goes anywhere close to a feasible solution.

hyvyys commented 4 years ago

Obviously I can do

:step="`${fontSizeStep}`"

as a workaround.

hyvyys commented 4 years ago

I've come up with this, the good part is that I inherited the JS and CSS and only overriden a few elements; the bad part is that I had to copy all the HTML to add new elements and modify props, but then I could do away with the <textarea v-else ... > so it's not that bad.

Expand code ```vue ```

Demo (video): https://recordit.co/nCOScALEEz

JosephusPaye commented 4 years ago

I think the type was made a string to match the way you would set it using HTML, but it should also support numbers too. 👍

hyvyys commented 4 years ago

Okay, I see. any is a valid value for step. Is there a way for UiTextbox to accept both types?

czw., 29 sie 2019, 01:21 użytkownik Josephus Paye II < notifications@github.com> napisał:

I think the type was made a string to match the way you would set it using HTML, but it should also support numbers too. 👍

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JosephusPaye/Keen-UI/issues/460?email_source=notifications&email_token=AE6ZWLWCHVPRJM4GJMPMN5LQG4B6RA5CNFSM4IPTXD5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5MX7VY#issuecomment-525959127, or mute the thread https://github.com/notifications/unsubscribe-auth/AE6ZWLQKHCEGNP4BL42PBT3QG4B6RANCNFSM4IPTXD5A .

JosephusPaye commented 4 years ago

Yeah, can be done like so:

https://github.com/JosephusPaye/Keen-UI/blob/c2cd4bf5dd3b7ab1557b97fee4cfccee19799f03/src/UiAutocomplete.vue#L108