Home >Web Front-end >JS Tutorial >How to get the text information of the current element from vue.js

How to get the text information of the current element from vue.js

亚连
亚连Original
2018-05-31 14:45:072389browse

Below I will share with you a vue.js method of obtaining text information of the current element. It has a good reference value and I hope it will be helpful to 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, You can use this method:

 problem1: function(e){
   console.log(e.target.innerText);
 }

This way it will be 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 what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Vue’s routing dynamic redirection and navigation guard examples

JS implements adding event operations for dynamically created elements Example

#Vue implementation of uploading images to the database and displaying them on the page function example

The above is the detailed content of How to get the text information of the current element from vue.js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn