Home > Article > Web Front-end > How to get the text information of the current element in vue.js
This article mainly shares with you a vue.js method of obtaining text information of the current element. It has a good reference value and I hope it can help everyone.
1. Get the currently clicked content
<li @click="problem1"> 1. <span class="blue">关于公众号使用问题</span> <img src="../img/right.png" alt=""/> </li>
When I click on this li tag, I want to get the text in the span. I can use this method:
problem1: function(e){ console.log(e.target.innerText); }
This is ok
2. Chinese judgment
Note: The character set must be correct, for example, they are all utf-8, or gbk. Otherwise the judgment will be wrong.
The above is the detailed content of How to get the text information of the current element in vue.js. For more information, please follow other related articles on the PHP Chinese website!