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 @ 2018-09-07 20:34  只争朝夕,不负韶华  阅读(18420)  评论(0编辑  收藏  举报