Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue3 源码 #49

Open
zhuzhh opened this issue Dec 26, 2021 · 0 comments
Open

vue3 源码 #49

zhuzhh opened this issue Dec 26, 2021 · 0 comments

Comments

@zhuzhh
Copy link
Owner

zhuzhh commented Dec 26, 2021

createApp运行过程是?

import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')

vreateApp -> 创建baseCreateRender -> 返回 render/createApp

image

组件本质?

组件本质是一个普通对象,但是必须携带render函数

render函数如何运行起来的?

组件在编译的时候,如何识别当前tag,是html标签还是自定义组件?

// shared/src/domTagConfig.ts
const HTML_TAGS =
  'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
  'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' + ......
(https://developer.mozilla.org/en-US/docs/Web/HTML/Element)
export const isHTMLTag = makeMap(HTML_TAGS)

从源码中可知,compiler-dom 在编译template的时候,会判断tag是否是html标签会svg标签

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant