data在vue项目里实际也是个函数,所以只要如下操作就行:
data() {
let self = this // 加上这一句就OK了
return {
sum: self.count() // count是vue项目里methods中的函数
}
methods: {
count() {
returm 1+2
}
}
data在vue项目里实际也是个函数,所以只要如下操作就行:
data() {
let self = this // 加上这一句就OK了
return {
sum: self.count() // count是vue项目里methods中的函数
}
methods: {
count() {
returm 1+2
}
}