<div class="scan" v-on:click="show">
<svg class="icon" aria-hidden="true">
<use xlink:href="-sharpicon-xiangji_"></use>
</svg>
</div>
<div id="cam" v-show="flag">
<button @click="back"></button>
</div>
js Code
var vm=new Vue({
el:"-sharpapp",
data:{
flag:false,
},
methods:{
show(){
var sp=document.getElementById("cam");
if(sp){
if(!sp.contains(event.target)){
this.flag=!this.flag
}
}
},
back(){
this.flag=!this.flag
}
}
})
this method found on the Internet does not seem to work, it only works for the current button. Ask for the guidance of the Great God
var sp=document.getElementById("cam");
if(sp){
if(!sp.contains(event.target)){
this.flag=!this.flag
}
}