Principle:

One: bidirectional and binding knowledge

1: Bidirectional refers to view and data

2: Binding: Traditionally, assign values by binding events (MVVM automation)

Principle 2:

Object.defineproperty will automatically call a callback function that listens for data changes in the forward direction

2: reversely passes the input event

Three:Object.defineProperty

// use __proto__ var obj = {}; var descriptor = Object.create(null); // Default no enumerable, no 64x, writable descriptor. Value ='static';
Object.defineProperty(obj, 'key', descriptor); / / explicit Object. DefineProperty (obj,"key", {
  enumerable: false,
  configurable: false,
  writable: false,
  value: "static"}); // Loop over the same objectfunction withValue(value) {
  var d = withValue.d || (
    withValue.d = {
      enumerable: false,
      writable: false,
      configurable: false,
      value: null
    }
  );
  d.value = value;
  return d;
}
// ... 并且 ...
Object.defineProperty(obj, "key", withValue("static")); // If freeze is available, prevent code from adding or removing attributes of the object prototype.setEnumerable, writable, configurable) (Object. Freeze | | Object) (Object. The prototype);Copy the code