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