this is a part of my code.
<input type="text" v-model="formData.end_date" name="end_date" v-validate="'required'"
v-bind:class="{'input-error' : errors.has('end_date')}">
<span v-show="errors.has('end_date')"
style="position: absolute; font-size: .7em ; margin-right: 1em;color: rgb(214, 48, 49);">{{errors.first('end_date') }}</span>
</div>
how can I add placeholder dynamically when error.has('end_date')
return true
I try v-bind: placeholder
this is a part of my code.
<input type="text" v-model="formData.end_date" name="end_date" v-validate="'required'"
v-bind:class="{'input-error' : errors.has('end_date')}">
<span v-show="errors.has('end_date')"
style="position: absolute; font-size: .7em ; margin-right: 1em;color: rgb(214, 48, 49);">{{errors.first('end_date') }}</span>
</div>
how can I add placeholder dynamically when error.has('end_date')
return true
I try v-bind: placeholder
- You can also use <input :placeholder="[[ urlPlaceholder ]]"> – Carca Commented Feb 21, 2020 at 13:35
3 Answers
Reset to default 4Try something like this:
1) Add a puted
property to your ponent
puted: {
placeholder() {
return this.errors.has('end_date') ? 'Your placeholder text' : ''
}
}
2) Bind to your puted placeholder property with v-bind:placeholder="placeholder"
you can get that done by saying :placeholder
. Is that not working for you ? In your try you have a space between v-bind:placeholder. I think you should not be having that.
<input
type="text"
v-model="FirstName"
class="form-control"
:placeholder="functionData"
/>
puted:{
functionData(){
return "Data"
}
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745234467a4617825.html
评论列表(0条)