Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

component.js函数的疑问 #59

Closed
Mister-Hope opened this issue Aug 28, 2019 · 0 comments
Closed

component.js函数的疑问 #59

Mister-Hope opened this issue Aug 28, 2019 · 0 comments

Comments

@Mister-Hope
Copy link
Contributor

Mister-Hope commented Aug 28, 2019

  def.properties = fns.extend({}, def.properties, {
    'ref': {
      type: String,
      value: '',
      observer: function (next) {
        /** 支持动态 ref */
        if (this._$ref !== next) {
          var $refs = this.$parent && this.$parent.$refs
          if ($refs) {
            let ref = $refs[this._$ref]
            delete $refs[this._$ref]
            this._$ref = next
            if (ref && next) {
              $refs[next]
            }
          }
        }
      }
    },

这一段中,最后的

if (ref && next) {
  $refs[next]
 }

有什么用么?$refs[next]也不是一个方法啊?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant