接上一篇出现的问题,现在基本懂了,因为在vue2中对HTML和body标签做了限制,其具体源码如下:1
2
3
4
5
6
7
8
9
10
111.src/entries/web-runtime-with-compiler.js
el = el && query(el)
/* istanbul ignore if */
if (el === document.body || el === document.documentElement) {
process.env.NODE_ENV !== 'production' && warn(
`Do not mount Vue to <html> or <body> - mount to normal elements instead.`
)
return this
}