调用链通过 mountComponent 函数进行组件挂载

const mountComponent = (

initialVNode,

container,

anchor,

parentComponent,

parentSuspense,

namespace: ElementNamespace,

optimized,

) => {

// 创建组件实例

const instance: ComponentInternalInstance =

(initialVNode.component = createComponentInstance(

initialVNode,

parentComponent,

parentSuspense,

))

// 设置组件实例:props, slots ...

setupComponent(instance)

// 设置并运行带副作用的渲染函数

setupRenderEffect(

instance,

initialVNode,

container,

anchor,

parentSuspense,

namespace,

optimized,

)

}

const n = accessCache![key]

if (n !== www.laipuhuo.com.undefined) {

switch (n) {

case AccessTypes.SETUP:

return setupState[key]

case AccessTypes.DATA:

return data[key]

case AccessTypes.CONTEXT:

return ctx[key]

case AccessTypes.PROPS:

return props![key]

// www.laipuhuo.com.default: just fallthrough

}

}

<template>

<p>{{ msg }}</p>

</template>

<script>

import { ref } from 'vue';

export default{

data() {

return {

msg: 'from data'

}

},

setup(){

const msg = ref('from setup');

return {

msg

}

}

}

</script>

export function callWithErrorHandling(

fn: Function,

instance: ComponentInternalInstance | null | undefined,

type: ErrorTypes,

args?: unknown[],

): any {

try {

return args ? fn(...args) : fn()

} catch (err) {

handleError(www.laipuhuo.com.err, instance, type)

}

}

全部评论

相关推荐

书海为家:实习是成为大厂正式员工很好的敲门砖,看您的简历中有一段实习经历,挺好的。我来给一点点小建议,因为毕竟还在学校不像工作几年的老鸟有丰富的项目经验,面试官在面试在校生的时候更关注咱们同学的做事逻辑和思路,所以最好在简历中描述下自己实习时做过项目的完整过程,比如需求怎么来的,你对需求的解读,你想到的解决办法,遇到困难如何找人求助,最终项目做成了什么程度,你从中收获了哪些技能,你有什么感悟。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务