MCPcopy Create free account
hub / github.com/ygs-code/vue / checkRootConstraints

Function checkRootConstraints

vue.js:13313–13328  ·  view source on GitHub ↗
(el)

Source from the content-addressed store, hash-verified

13311
13312 //检查根约束 根节点不能是slot或者template标签,并且不能含有v-for 属性
13313 function checkRootConstraints(el) {
13314 {
13315 if (el.tag === 'slot' || el.tag === 'template') {
13316 warnOnce(
13317 "Cannot use <" + (el.tag) + "> as component root element because it may " +
13318 'contain multiple nodes.'
13319 );
13320 }
13321 if (el.attrsMap.hasOwnProperty('v-for')) {
13322 warnOnce(
13323 'Cannot use v-for on stateful component root element because ' +
13324 'it renders multiple elements.'
13325 );
13326 }
13327 }
13328 }
13329
13330 // tree management
13331 if (!root) {

Callers 1

parseFunction · 0.85

Calls 1

warnOnceFunction · 0.85

Tested by

no test coverage detected