mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
warn against multiple root elements
This commit is contained in:
parent
0e1ac07919
commit
448f3a6a78
@ -23,6 +23,10 @@ export function parse (html, preserveWhiteSpace) {
|
||||
}
|
||||
if (!root) {
|
||||
root = element
|
||||
} else if (!stack.length) {
|
||||
console.error(
|
||||
'Component template should contain ony one root element:\n\n' + html
|
||||
)
|
||||
}
|
||||
if (currentParent) {
|
||||
currentParent.children.push(element)
|
||||
@ -37,6 +41,7 @@ export function parse (html, preserveWhiteSpace) {
|
||||
currentParent = stack[stack.length - 1]
|
||||
},
|
||||
chars (text) {
|
||||
if (!currentParent) return
|
||||
text = currentParent.tag === 'pre'
|
||||
? decodeHTML(text)
|
||||
: text.trim()
|
||||
|
Loading…
Reference in New Issue
Block a user