Open lavezzi1 opened 8 years ago
Yes, you can do. As far as I understand your comment, the following.
<div id="app">
<validator name="validation1">
<input type="text" :value="msg" v-validate:comment="['required']"/>
</validator>
</div>
@kazupon I'll try to explain deeply. I want to implement floated label, so when you click on input and enter some value the label should appear on the top left corner. I can do this:
:class={'show-label': $validation.modified}
But problem comes when input has some value initially. So how to determine that input already modified or something? And apply the show-label initially in this case.
@lavezzi1 Why dont' you simply add the class when model's value is not empty:
<input v-model="msg" :class="{ 'show-label': msg !== '' }" type="text" />
I don't think your problem is related to vue-validator.
vue 1.0.28 validator 2.1.7
Can I check if input has value (initially when page is loaded?) then apply some class? I know I can work with 'modified' event but it works only when user change value. Thanks!