MCPcopy Index your code
hub / github.com/ygs-code/vue / CodegenState

Function CodegenState

vue.js:14629–14697  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

14627 * */
14628
14629 var CodegenState = function CodegenState(options) {
14630 this.options = options;
14631 this.warn = options.warn || baseWarn; //警告日志输出函数
14632 /*
14633 * 为虚拟dom添加基本需要的属性
14634 modules=modules$1=[
14635 { // class 转换函数
14636 staticKeys: ['staticClass'],
14637 transformNode: transformNode,
14638 genData: genData
14639 },
14640 { //style 转换函数
14641 staticKeys: ['staticStyle'],
14642 transformNode: transformNode$1,
14643 genData: genData$1
14644 },
14645 {
14646 preTransformNode: preTransformNode
14647 }
14648 ]
14649 */
14650
14651 //循环过滤数组或者对象的值,根据key循环 过滤对象或者数组[key]值,如果不存在则丢弃,如果有相同多个的key值,返回多个值的数组
14652 //这里返回是空
14653 this.transforms = pluckModuleFunction(options.modules, 'transformCode');
14654
14655 //获取到一个数组,数组中有两个函数genData和genData$1
14656 this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
14657 console.log(this.transforms)
14658 console.log(this.dataGenFns)
14659 console.log(options)
14660
14661
14662 // options.directives= {
14663 // model: model, //根据判断虚拟dom的标签类型是什么?给相应的标签绑定 相应的 v-model 双数据绑定代码函数
14664 // text: text, // 为虚拟dom添加textContent 属性
14665 // html: html// 为虚拟dom添加innerHTML 属性
14666 // }
14667 /*
14668 * 基本指令参数
14669 */
14670 // var baseDirectives = {
14671 // on: on, //包装事件
14672 // bind: bind$1, //包装数据
14673 // cloak: noop //空函数
14674 // }
14675
14676 // var directives$1 = {
14677 // model: model, //根据判断虚拟dom的标签类型是什么?给相应的标签绑定 相应的 v-model 双数据绑定代码函数
14678 // text: text, // 为虚拟dom添加textContent 属性
14679 // html: html// 为虚拟dom添加innerHTML 属性
14680 // }
14681 // 扩展指令,on,bind,cloak,方法
14682 this.directives = extend(
14683 extend(
14684 {},
14685 baseDirectives
14686 ),

Callers

nothing calls this directly

Calls 3

pluckModuleFunctionFunction · 0.85
extendFunction · 0.85
isReservedTagFunction · 0.85

Tested by

no test coverage detected