Article content output source: pull hook big front-end high salary training camp

Mini Vue

Outside the entrance

Data data passed in from outside the proxy

Use the Observer to hijack incoming data

Use Compiler to parse instructions and interpolation expressions

The Compiler Compiler

Serve the mini Vue

Used to compile HTML templates

When the instruction is processed, the subscriber Watcher is called to implement the update subscription of the view.

Data hijacking Observer

Serve the mini Vue

Used to convert Vue delegate data into responsive data.

Use the publisher Dep to collect dependencies when retrieving data externally.

Watcher is notified of all subscribers using the publisher Dep when data is updated externally so that the view is updated in real time.

The subscriber Watcher

Serves the mini Vue indirectly

Is used to bind the view update function when processing instructions in the Compiler

When a subscriber is created, it subscribes to changes to the specified key product published by the publisher Dep

When the key product changes, you call your own update function to update the view.

The publisher Dep

Watcher holds all the subscribers

Has a method to receive subscriptions from Watcher, a subscriber.

A method used to notify all subscriber Watcher of key product changes.

  • The Data hijacking Observer is used to notify all observers that Watcher has changed the key product to which it is subscribed.