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

Function normalizeDirectives

vue.js:2095–2111  ·  view source on GitHub ↗

* Normalize raw function directives into object format. * * 将原始函数指令归一化为对象格式。 * * * normalizeDirectives获取到指令对象值。循环对象指令的值,如果是函数则把它变成dirs[key] = {bind: def, update: def} 这种形式

(options)

Source from the content-addressed store, hash-verified

2093 * normalizeDirectives获取到指令对象值。循环对象指令的值,如果是函数则把它变成dirs[key] = {bind: def, update: def} 这种形式
2094 */
2095 function normalizeDirectives(options) {
2096 //获取参数中的指令
2097 var dirs = options.directives;
2098 console.log(options)
2099
2100 if (dirs) { //如果指令存在
2101 for (var key in dirs) { //循环该指令
2102 var def = dirs[key]; //获取到指令的值
2103 console.log(def)
2104
2105 if (typeof def === 'function') { //如果是函数
2106 //为该函数添加一个对象和值
2107 dirs[key] = { bind: def, update: def };
2108 }
2109 }
2110 }
2111 }
2112
2113 //判断是否是对象
2114 function assertObjectType(name, value, vm) {

Callers 1

mergeOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected