admin管理员组文章数量:1415484
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"
}
}
本文标签: javascriptadd placeholder dynamically vuejsStack Overflow
版权声明:本文标题:javascript - add placeholder dynamically vuejs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745234466a2648971.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论