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。