Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
99
rated 0 times [  100] [ 1]  / answers: 1 / hits: 24037  / 7 Years ago, sat, september 30, 2017, 12:00:00

I have a form and I need to call a method from a placeholder and also from other types of html attribute.



Is there anyways I can call a vue method?
Here is what I am trying to do



<input type=text class=form-control v-model=user.userName 
placeholder=t(un) required> // want to call method t() from the placeholder


It seems this method cannot be called this way. Is there any other ways to achieve this?



And my method is



methods: {
t(key){
console.log(key)
var local='fr';
return this.trans(key,local);
}
}

More From » vue.js

 Answers
47

Use v-bind (https://v2.vuejs.org/v2/api/#v-bind)


<input type="text" class="form-control" v-model="user.userName" 
v-bind:placeholder="t('un')" required>

[#56346] Wednesday, September 27, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
susanajamiep

Total Points: 466
Total Questions: 113
Total Answers: 108

Location: Liberia
Member since Fri, Oct 22, 2021
3 Years ago
susanajamiep questions
Sun, Jun 12, 22, 00:00, 2 Years ago
Mon, Mar 7, 22, 00:00, 2 Years ago
Wed, Jun 10, 20, 00:00, 4 Years ago
Fri, Jan 24, 20, 00:00, 4 Years ago
;