[Vue source code] Principles of template compilation in Vue

1. The principle of template compilation in Vue

Principle: Convert template into render function

The abstract syntax code (AST) is a tree-like representation of the abstract syntax structure of the source code. Each node on the tree represents a structure in the source code. It is abstract because of the abstract syntax tree. It does not show every detail that appears in the real grammar. For example, nested parentheses are implicit in the structure of the tree and are not presented in the form of nodes.

Vue2.0 uses simplehtmlparser.js by JQ father Erik Arvidsson

1. Convert the template into an AST abstract syntax tree
function baseCompile ( template: string, options: CompilerOptions ) {
   
    
    
	const 

Guess you like

Origin blog.csdn.net/iChangebaobao/article/details/109174199