Scenario: An inspection document has n inspection details, and an inspection detail has n inspection items. Implementation effect: When the mouse moves to the summary icon of the detail row, the pop-up window of the inspection item card of the current row is displayed, and the pop-up window is closed when the mouse moves out of the pop-up window Inspection document details Move the mouse over the project overview icon Effect realizationVariables declared in data //Outline pop-up window outlineDialog: false, //Standard summary of the current row standSummary: [], // Outline pop-up window position control outlineCard: { pageY: null, pageX: null, display: "none" } 1. Pop-up code outlineDialog: default false, outline pop-up window display logo <!-- Project Overview --> <div class="summary-div" v-show="outlineDialog" ref="box-cardDiv" :style="outlineStyle" @mouseleave="leave"> <div class="summary-title">Project Summary</div> <ul class="summary-ul"> <li class="summary-li"><span>Standard Name</span><span>Is it required?</span><span>Is it displayed?</span></li> <li v-for="(item, index) in standSummary" :key="index" class="summary-li"><span>{{item.inspectdetailName}}</span><span>{{item.isRequired ? 'Yes' : 'No'}}</span> <span>{{item.isDisplay ? 'Yes' : 'No'}}</span> </li> </ul> </div> 2. Pop-up window style code <style lang="scss"> #box-cardDiv { position: absolute; } .summary-div { border: solid 1px #eee; background-color: #fff; border-radius: 4px; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1); padding: 10px 10px 0 10px; width: 300px; position: absolute; font-size: 13px; } .summary-ul { list-style: none; padding-left: 0; max-height: 350px; overflow-x:hidden; overflow-y: auto; } .summary-li { margin: 10px 10px 15px 10px; width: 250px; text-overflow: ellipsis; overflow: hidden; /* white-space: nowrap; */ display: flex; span { margin: auto; width: 55px; } } .summary-li:first-child span:not(:first-child) { margin-left: 40px; } .summary-li:not(:first-child) span:nth-child(1) { width: 90px; } .summary-li:not(:first-child) span:nth-child(2) { width: 50px; margin-left: 45px; } .summary-li:not(:first-child) span:nth-child(3) { margin-left: 60px; } .summary-title { color: #cccccc; margin-left: 10px; } </style> 3. Item Summary Column Code of Detailed Table checkStandSunmmary: The event when the mouse moves to the summary icon <el-table-column label="Project Overview" align="center" width="500"> <template slot="header"> <span>Project Overview</span> <span class="vertical"></span> </template> <template slot-scope="scope"> <div class="col-summmary-div"> <span class="col-summmary-format"><span>{{scope.row.firstListItem}}</span></span> <span> {{scope.row.equInspectplanItemList.length}} items</span> <i class="el-icon-arrow-down" @mouseenter="checkStandSunmmary(scope.row)"></i> </div> </template> </el-table-column> 4. outlineStyle pop-up card dynamic style control When the details are at the bottom of the page, the card will still be displayed but part of it will be covered. You need to dynamically calculate the position of the card opening according to the position of the summary icon. If it is at the bottom, open the card upwards. computed: { outlineStyle() { let h = 45 * this.standSummary.length; let browser = document.body.clientHeight - 50; let pageY = this.outlineCard.pageY - 50; let pageX = this.outlineCard.pageX - 280; if (pageY + h > browser) { return `left: ${ pageX }px; top: ${ (pageY-h) }px; position: absolute; display: ${ this.outlineCard.display }`; } else { return `left: ${ pageX }px; top: ${ (pageY-60) }px; position: absolute; display: ${ this.outlineCard.display }`; } } }, 5. Leave event when the mouse leaves the pop-up card When the mouse moves out of the card, set the card /** * Mouse leave standard summary */ leave() { this.outlineCard.display = "none"; this.outlineDialog = false; }, 6. checkStandSunmmary event when the mouse moves to the summary icon Open the pop-up card and get the inspection items of the current row. Get the current mouse position on the X and Y axes of the browser. Dynamically set the pop-up card style to null (display is displayed except for none, which means it is not displayed) /** * Current row standard summary */ checkStandSunmmary(row) { this.outlineDialog = true; this.standSummary = row.equInspectplanItemList; this.outlineCard.pageY = window.event.clientY; this.outlineCard.pageX = window.event.clientX; this.outlineCard.display = null; }, SummarizeThis is the end of this article about the Vue+Element UI implementation summary pop-up window. For more relevant Vue+Element UI pop-up window content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: The latest MySQL 5.7.23 installation and configuration graphic tutorial
>>: Detailed explanation of nmcli usage in CentOS8
This article is from Tom Ewer's Managewp blog,...
This article shares the specific code of jQuery t...
1. Check the character set of MySQL show variable...
Question Guide 1. How does Hadoop 3.x tolerate fa...
content Use scaffolding to quickly build a node p...
Install using the MSI installation package Downlo...
1 Introduction Apache Storm is a free, open sourc...
1. Introduction to mysqldump mysqldump is a logic...
The topic I want to share with you today is: &quo...
Table of contents 1 Test Cases 2 JS array dedupli...
Table of contents What is async? Why do we need a...
Table of contents Deploy nginx on server1 Deploy ...
ps: The environment is as the title Install possi...
Preface When the HTML structure of a page contain...
After setting up the MySQL master-slave, you ofte...