Home  >  Article  >  Web Front-end  >  How vue.js implements pop-up window function

How vue.js implements pop-up window function

王林
王林Original
2021-10-09 16:38:493788browse

Vue.js method to implement pop-up window function: [document.addEventListener('mouseup',(e)=>{var _con = document.getElementById('children-view')if(_c.. .】.

How vue.js implements pop-up window function

The operating environment of this article: windows10 system, vue.js 2.9, thinkpad t480 computer.

Implementation ideas:

After clicking, click on another location to jump to the route. After the route jumps, use the computed attribute to monitor $route to display and hide the class. The js Contains method is used.

Implementation code:

document.addEventListener('mouseup',(e)=>{
   var _con = document.getElementById('children-view')
   if(_con && !_con.contains(e.target){
       this.$route.push({
           name:"Index"
       })    
   } 
})

How vue.js implements pop-up window function

Recommended learning: php training

The above is the detailed content of How vue.js implements pop-up window function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn