MCPcopy
hub / github.com/fanmingming/live / extractPropsFromVNodeData

Function extractPropsFromVNodeData

m3u8/vue.js:2270–2309  ·  view source on GitHub ↗
(
    data,
    Ctor,
    tag
  )

Source from the content-addressed store, hash-verified

2268 /* */
2269
2270 function extractPropsFromVNodeData (
2271 data,
2272 Ctor,
2273 tag
2274 ) {
2275 // we are only extracting raw values here.
2276 // validation and default values are handled in the child
2277 // component itself.
2278 var propOptions = Ctor.options.props;
2279 if (isUndef(propOptions)) {
2280 return
2281 }
2282 var res = {};
2283 var attrs = data.attrs;
2284 var props = data.props;
2285 if (isDef(attrs) || isDef(props)) {
2286 for (var key in propOptions) {
2287 var altKey = hyphenate(key);
2288 {
2289 var keyInLowerCase = key.toLowerCase();
2290 if (
2291 key !== keyInLowerCase &&
2292 attrs && hasOwn(attrs, keyInLowerCase)
2293 ) {
2294 tip(
2295 "Prop \"" + keyInLowerCase + "\" is passed to component " +
2296 (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
2297 " \"" + key + "\". " +
2298 "Note that HTML attributes are case-insensitive and camelCased " +
2299 "props need to use their kebab-case equivalents when using in-DOM " +
2300 "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
2301 );
2302 }
2303 }
2304 checkProp(res, props, key, altKey, true) ||
2305 checkProp(res, attrs, key, altKey, false);
2306 }
2307 }
2308 return res
2309 }
2310
2311 function checkProp (
2312 res,

Callers 1

createComponentFunction · 0.85

Calls 4

isUndefFunction · 0.85
isDefFunction · 0.85
hasOwnFunction · 0.85
checkPropFunction · 0.85

Tested by

no test coverage detected