再找template
template是html的模版
template写的是#id
template写的是获取好的某个节点:document.querySelector
给options添加render
const {render, staticRenderFns} = <font color="#b71c1c">compileToFunctions</font>(template,options)
const {compile, <font color="#b71c1c">compileToFunctions</font>}=<font color="#b71c1c" style="">createCompiler</font>(baseOptions)
<font face="黑体" style="" color="#b71c1c">createCompiler</font> = <font color="#b71c1c">createCompilerCreator</font>(<font color="#000000">function baseCompile(template,options){}</font>)
function <font color="#b71c1c">createCompilerCreator</font>(<font color="#000000">baseCompile</font>){<br> return function <font color="#b71c1c">createCompiler</font>(baseOptions){<br> function <font color="#000000">compile</font>(template,options){<br> <font color="#000000">// 合并options</font><br> const finalOptions = Object.create(baseOptions)<br> finalOptions.modules = baseOptions.modules.concat(options.modules)<br> finalOptions.directives = extend(Object.create(baseOptions.directives, options.directives))<br> for(const key in options){<br> key !== 'modules' && key !== "directives" && (finalOptions[key]=options[key])<br> }<br> const compiled = <font color="#000000">baseCompile</font>(template.trim(),finalOptions)<br> }<br> return {<font color="#000000">compile</font>, <font color="#000000">compileToFunctions</font>: <font color="#000000">createCompileToFunctionFn</font>(<font color="#000000">compile</font>)}<br> }<br>}<br>
function <font color="#000000">createCompileToFunctionFn</font>(<font color="#b71c1c">compile</font>){<br> return function <font color="#000000">compileToFunctions</font>(template,options,vm){<br> const compiled = <font color="#000000" style="">compile</font>(template,options)<br> return compiled<br> }<br>}
baseOptions
expectHTML:true
modules
klass
staticKeys:['staticClass']
transformNode
genData
style
staticKeys:['staticStyle']
transformNode
genData
directives
model
text
html
mustUseProp
canBeLeftOpenTag
isReservedTag
html相关
svg相关
getTagNamespace
staticKeys:genStaticKeys(modules)
把modlules中的staticKeys包含在一块儿