vue组件编译原理

<body>

  <my-com1 type="type" v-pre="pre">com1</my-com1>

  <my-com2>com2</my-com2>

  <div>div</div>

</body>

document.getElementsByTagName('body')[0].childNodes[0].tagName  "MY-COM1"

document.getElementsByTagName('body')[0].childNodes[0].toString()
"[object HTMLElement]"

document.getElementsByTagName('body')[0].childNodes[0].getAttribute('type')  type

document.getElementsByTagName('body')[0].childNodes[0].getAttribute('v-pre') pre

关于自定义元素 请看推荐文章

http://blog.bingo929.com/custom-elements-html-web-components.html

原文地址:https://www.cnblogs.com/chenxijywc/p/5996599.html