vue中methods函数调用methods函数写法

 1 export default {
 2   data() {
 3     return {
 4       hello:"你好"
 5     }
 6   },
 7   methods:{
 8     open(that) {
 9       that.hello = "hello world!"
10     },
11     close() {
12       this.$options.methods.open(this)
13     }
14   }
15 }

close函数调用open函数,close函数里调用的open函数的参数this赋值给that,这样可以通过that调用到data中的hello。

原文地址:https://www.cnblogs.com/planetwithpig/p/11685929.html