Home > Article > Web Front-end > Detailed explanation of the steps for vue1 and vue2 to obtain dom elements
This time I will bring you a detailed explanation of the steps for vue1 and vue2 to obtain dom elements. What are the precautions for vue1 and vue2 to obtain dom elements. The following is a practical case, let's take a look.
vue1.*In version
Add el='dom' to the tag, and then add this.$els.dom in the code In this way, you get the page element
For example:
Hello
Make your good color appear in red: this.$els.my-box.style.color = 'red'
##vue2.*version
Add ref='dom' in the tag, and then add this.$refs.dom in the code to get the page elementFor example: Hello
Detailed explanation of the steps to add events to dynamically created elements using JS
How to operate the vue function calling sequence
The above is the detailed content of Detailed explanation of the steps for vue1 and vue2 to obtain dom elements. For more information, please follow other related articles on the PHP Chinese website!