Error in v-on handler: “ReferenceError: isShow is not defined“

code show as below:

const vm=new Vue({
            el:'#app',
            data:{
                isShow:true
            },
            methods:{
                dian(){
                    isShow=!isShow
                }
            }
        })

The reason for the error is because:

 In the v-on command, the variable isShow is not defined, but I have defined the variable isShow in the data in the code. After checking, it turns out that if you want to use the variable above the instance in the method, you must use this to Point to this variable, after adding this point to isShow, the problem is solved

Modify the code as follows:

 To solve the problem, everyone must be clear about the ins and outs, otherwise you will be as confused as I am☹.

Guess you like

Origin blog.csdn.net/m0_50013284/article/details/125717671