problem description
just learned from vue2,. The data of a component must be a method, which is defined as shown in Code 1
.Code 1:
//1
data: function () {
return {
count: 0
}
}
and the methods defined in methods in vue are shown in Code 2
Code 2:
...
methods: {
//2
routeChange () {
console.log("test")
}
},
is also defined why method 1 and method 2 are defined in a different way?
emm. I also want Baidu, but I don"t know where to ask, so I came here specially to ask for help, emm.. Please forgive me for asking too mentally retarded when I first entered the front end. If you have any trouble to answer, thank you very much for the ^-^-sharp-sharp-sharp question description
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)