本章内容中的 this.localCaptcha = captcha 咋理解呢?

 methods: {
    getCaptcha() {
      const { tpl, captcha } = createCaptcha()

      this.captchaTpl = tpl
      this.localCaptcha = captcha
    }
  }

上面的this.localCaptcha=captcha 这是个啥?求解~~

讨论数量: 3
zs4336
methods: {
    getCaptcha() {
      // es6 语法 对象解构赋值
      const { tpl, captcha } = createCaptcha()

      this.captchaTpl = tpl
      this.localCaptcha = captcha
    }
  }

this.localCaptcha = captcha 就是一个简单的赋值啊

4年前 评论

保留当前生成的验证码,以后校验时会用到

4年前 评论

同样的问题,localCaptcha 好像没有在data中定义。但是其实是通过data中可以访问的,可以这样理解吧。

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!