Below I will share with you a method of obtaining dom elements based on vue1 and vue2. It has a good reference value and I hope it will be helpful to everyone.
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 VUE Extension of ElTableColumn in element-ui
Detailed explanation of Vue custom dynamic component instance
Introduction to time-sharing functions for javascript performance optimization
The above is the detailed content of Method to obtain dom elements based on vue1 and vue2. For more information, please follow other related articles on the PHP Chinese website!