Here is the code:
<li v-for="u in usersList">
<strong><a class="username" @click="openChatbox">${ u } </a></strong>
</li>
and the handling method:
openChatbox: function() {
target = event.target || event.srcElement;
this.isOpen = !this.isOpen;
this.recepient = target.innerHTML
},
The problem is that this method sets recepient
like <strong>noob</strong>
when u
value is noob
. How can I get only noob
?
Here is the code:
<li v-for="u in usersList">
<strong><a class="username" @click="openChatbox">${ u } </a></strong>
</li>
and the handling method:
openChatbox: function() {
target = event.target || event.srcElement;
this.isOpen = !this.isOpen;
this.recepient = target.innerHTML
},
The problem is that this method sets recepient
like <strong>noob</strong>
when u
value is noob
. How can I get only noob
?
1 Answer
Reset to default 8You can pass the user like following in the method:
<li v-for="u in usersList">
<strong><a class="username" @click="openChatbox(u)">${ u } </a></strong>
</li>
and use it in method like this:
openChatbox: function(user) {
//use user here
},
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742398715a4436473.html
评论列表(0条)