Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to close the pop-up window by vuejs

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "vuejs how to close the pop-up window", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "vuejs how to close the pop-up window" this article.

Vuejs closes the pop-up window: 1, create the html code structure; 2, determine whether the clicked area is in ".mask _ popup"; 3, close the pop-up window through "hideMaskPopup (e) {...}".

This article operating environment: windows7 system, vue2.5.17 version, DELL G3 computer.

How does vuejs close the pop-up window?

Vue.js clicks outside the pop-up window to close the pop-up window

Click the area outside the popup window to close the code structure of the popup window.

Html:

Content code.

Js:

Data () {showMaskPopup:false}, methods: {hideMaskPopup (e) {let mask = document.querySelector (".mask _ popup"); if (mask) {if (! mask (e.target)) {/ / determine whether the clicked area is in .mask _ popup this.showMaskPopup = false }}

Achieve results:

The above is all the contents of the article "how to close the pop-up window in vuejs". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report