Preface The solution to the problem of not being able to obtain elements for the first time in Vue is whether you often click the pop-up button for the first time to obtain the elements in the pop-up window. When you open the pop-up window to get the element, it is empty and you have to open it a second time to get it. 1. Get after updating DOM this.$nextTick(callback) methods: { play() { //Get the element console.log($('#video')); this.$nextTick(function() { //Get the element console.log($('#video')); }); } } 2. Get through timer setTimeOut(fn, 0) methods:{ play() { //Get the element console.log($('#video')); setTimeOut(function(){ //Get the element console.log($('#video')); }, 0); } } 3. Get by triggering events @opened <el-dialog @opened="play"></el-dialog> methods: { play() { //Get the element console.log($('#video')); } } Summarize This is the end of this article about how to solve the problem that vue cannot get elements for the first time. For more relevant content about vue cannot get elements, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: How to build a multi-node Elastic stack cluster on RHEL8 /CentOS8
>>: MySQL 8.0.13 installation and configuration method graphic tutorial under win10
In the horizontal direction, you can set the alig...
This should be something that many people have do...
Preface During the development process, we often ...
Before using jQuery to complete the fade-in and f...
Caused by: java.sql.SQLException: Incorrect strin...
1. Complex SQL queries 1.1. Single table query (1...
stat function and stat command Explanation of [in...
Preface For cost considerations, most webmasters ...
1. View existing modules /usr/local/nginx/sbin/ng...
Table of contents 1. Pull the image 2. Create a R...
What is bubbling? There are three stages in DOM e...
This article describes the VMware virtual machine...
1. Go to the official website www.mysql.com and s...
<br />Original text: http://www.mikkolee.com...
The show processlist command is very useful. Some...