Reputation: 14874
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
?
Upvotes: 5
Views: 3716
Reputation: 73659
You 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
},
Upvotes: 8