jonathanpmartins / v-money3

Vue3 currency input/directive mask
MIT License
103 stars 27 forks source link

[solved] Associate input with a label. #4

Closed jonathanpmartins closed 3 years ago

jonathanpmartins commented 3 years ago

This issue was originally open by @edsonfeimberg in the old repo. https://github.com/vuejs-tips/v-money/issues/104

Following the Mozzila web docs: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#simple_label_example, you can accomplish this by wrapping the v-money3 component inside a label tag...

<label>
    Price
    <v-money3/>
</label>

Or you can use the for attribute

<label for="custom-id">Price</label>
<v-money3 id="custom-id"/>

The second option wasn't possible. So I created a commit that passes the id attribute down to the native input tag.