github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/themes/wind/static/libs/vue-1.0.24/src/directives/public/el.js (about)

     1  import { camelize, hasOwn, defineReactive } from '../../util/index'
     2  import { EL } from '../priorities'
     3  
     4  export default {
     5  
     6    priority: EL,
     7  
     8    bind () {
     9      /* istanbul ignore if */
    10      if (!this.arg) {
    11        return
    12      }
    13      var id = this.id = camelize(this.arg)
    14      var refs = (this._scope || this.vm).$els
    15      if (hasOwn(refs, id)) {
    16        refs[id] = this.el
    17      } else {
    18        defineReactive(refs, id, this.el)
    19      }
    20    },
    21  
    22    unbind () {
    23      var refs = (this._scope || this.vm).$els
    24      if (refs[this.id] === this.el) {
    25        refs[this.id] = null
    26      }
    27    }
    28  }