點擊非組件任意地方 隱藏組件

在mounted 中綁定函數

 

在組件page 上綁定 ref 獲取組件

document.addEventListener('click',(e)=>{

if(this.$refs.transfer){

if(!this.$refs.transfer.contains(e.target)){

this.showTransfer = false;

}

}

})

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章