dist/main.js
/**
   * Define a reactive property on an Object.
   */
Define a reactive property on an Object.
Define a reactive property on an Object .
function defineReactive$$1(obj, key, val, customSetter, shallow) {
    var dep = new Dep();
    var property = Object.getOwnPropertyDescriptor(obj, key);
    if (property && property.configurable === false) {
      return;
    }
    var getter = property && property.get;
    var setter = property && property.set;
    if ((!getter || setter) && arguments.length === 2) {
      val = obj[key];
    }
    var childOb = !shallow && observe(val);
    Object.defineProperty(obj, key, {
      enumerable: true,
      configurable: true,
      get: function reactiveGetter() {
        var value = getter ? getter.call(obj) : val;
        if (Dep.target) {
          dep.depend();
          if (childOb) {
            childOb.dep.depend();
            if (Array.isArray(value)) {
              dependArray(value);
            }
          }
        }
        return value;
      },
      set: function reactiveSetter(newVal) {
        var value = getter ? getter.call(obj) : val;
        if (newVal === value || newVal !== newVal && value !== value) {
          return;
        }
        if (customSetter) {
          customSetter();
        }
        if (getter && !setter) {
          return;
        }
        if (setter) {
          setter.call(obj, newVal);
        } else {
          val = newVal;
        }
        childOb = !shallow && observe(newVal);
        dep.notify();
      }
    });
  }
function defineReactive$$1 ( obj , key , val , customSetter , shallow ) { var dep = new Dep ( ) ; var property = Object . getOwnPropertyDescriptor ( obj , key ) ; if ( property && property . configurable === false ) { return ; } var getter = property && property . get ; var setter = property && property . set ; if ( ( ! getter || setter ) && arguments . length === 2 ) { val = obj [ key ] ; } var childOb = ! shallow && observe ( val ) ; Object . defineProperty ( obj , key , { enumerable : true , configurable : true , get : function reactiveGetter ( ) { var value = getter ? getter . call ( obj ) : val ; if ( Dep . target ) { dep . depend ( ) ; if ( childOb ) { childOb . dep . depend ( ) ; if ( Array . isArray ( value ) ) { dependArray ( value ) ; } } } return value ; } , set : function reactiveSetter ( newVal ) { var value = getter ? getter . call ( obj ) : val ; if ( newVal === value || newVal !== newVal && value !== value ) { return ; } if ( customSetter ) { customSetter ( ) ; } if ( getter && ! setter ) { return ; } if ( setter ) { setter . call ( obj , newVal ) ; } else { val = newVal ; } childOb = ! shallow && observe ( newVal ) ; dep . notify ( ) ; } } ) ; }
Define a reactive property on an Object.
Define a reactive property on an Object .
// cater for pre-defined getter/setters /* eslint-disable no-self-compare */ /* eslint-enable no-self-compare */ // #7981: for accessor properties without setter