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。

相关文章:

  • 2021-07-16
  • 2021-05-24
  • 2021-11-27
  • 2022-03-03
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-06
  • 2021-08-16
  • 2022-12-23
  • 2021-07-28
  • 2022-01-11
相关资源
相似解决方案