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。

posted @ 2019-10-16 15:47  用脑袋行走的人  阅读(10078)  评论(0编辑  收藏  举报