Business scenario: Use vue + element ui's el-dialog. After clicking the pop-up window, the data of the first button is loaded by default for initialization. div instruction: // Automatically trigger click events directives:{ trigger:{ inserted(el,binging){ // console.log("Automatically trigger events") el.click() } } }, PS: Let's take a look at vue automatically triggering click events Yes, click on the list on the left to get the details, but a click event is required. When the page comes in, the click event is triggered by default. Method 1, vue custom instructions directives:{ trigger:{ inserted(el, binging){ console.log(el.id) el.id == 'nav0' ? el.click() : null // Only click the first one, the id is manually added in the loop // $(el).trigger('click') // All are triggered once, then the last one} } }, usage: <span class="nav-item" :id="'nav' + index" v-trigger :class="{'active': item.stage == activeId}" @click="navClick(item)" v-for="(item, index) in nav" :key="item.stage">{{item.stage_name}}</span> The above is the detailed content of the solution (simulated scenario) for automatically triggering click events by clicking on the pop-up window of Vue. For more information about automatically triggering click events of Vue, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Linux 6 steps to change the default remote port number of ssh
Google China has released a translation tool that ...
Find the problem Today I am going to study the to...
First, let’s take an example: There is a type fie...
Table of contents Merge namespaces with the same ...
When I was writing a project yesterday, I needed ...
Preface: To store multiple elements, arrays are t...
Overview The prototype pattern refers to the type...
Purpose: Treat Station A as the secondary directo...
Mobile Mobile pages only need to be compatible wi...
Table of contents 1. Detailed explanation of MySQ...
This article shares the specific code of JavaScri...
Table of contents Let's talk about flattening...
1.What is margin? Margin is used to control the sp...
Input subsystem framework The linux input subsyst...
This article records the detailed installation tu...