Vue clicks to execute one function at a time, and then clicks to execute another function, and it can execute infinitely.

vue clicks to execute one function at a time, and then clicks to execute another function, and it can execute infinitely

.
Mar.20,2021

set a switch, write a function 3, and use the switch to determine whether function 1 or function 2

let one=true

function fn3 () {

if(one){
    fn1()
}else{
    fn2()
}
one=!one

}


I got it. It goes like this:
let flag=0;
export default {

methods: {
  screen:function () {
    if(flag===0){
      this.fullScreen()
      flag=1
    }
    else{
      this.exitFullScreen()
      flag=0
    }
  },
  fullScreen:function(){},
  exitFullScreen:function(){}

}


Boolean conversion, or one function and one condition

Menu