当前位置: 首页 > news >正文

济宁房产网站建设网站开发软件设计文档模板

济宁房产网站建设,网站开发软件设计文档模板,wordpress图片链接原图,建设网站中期要做什么slot 插槽的实现实际上就是一种 延时渲染#xff0c;把父组件中编写的插槽内容保存到一个对象上#xff0c;并且把具体渲染 DOM 的代码用函数的方式封装#xff0c;然后在子组件渲染的时候#xff0c;根据插槽名在对象中找到对应的函数#xff0c;然后执行这些函数做真正的…slot 插槽的实现实际上就是一种 延时渲染把父组件中编写的插槽内容保存到一个对象上并且把具体渲染 DOM 的代码用函数的方式封装然后在子组件渲染的时候根据插槽名在对象中找到对应的函数然后执行这些函数做真正的渲染。 /*** 创建 vnode*/ function createVNode(type, props null, children null) {if (props) {// 处理 props 相关逻辑标准化 class 和 style}// 对 vnode 类型信息编码// 创建 vnode 对象const vnode {type,props,// 其他一些属性}// 标准化子节点把不同数据类型的 children 转成数组或者文本类型normalizeChildren(vnode, children)return vnode }/*** 标准化子节点以及获取 vnode 节点类型 shapeFlagshapeFlag 最终为 SLOTS_CHILDREN | STATEFUL_COMPONENT*/ function normalizeChildren(vnode, children) {let type 0const { shapeFlag } vnode// 没有子节点if (children null) {children null}// 子节点为数组else if (isArray(children)) {type 16 /* ARRAY_CHILDREN */}// 子节点为对象else if (typeof children object) {// 子节点为元素或 teleportif ((shapeFlag 1/* ELEMENT */ || shapeFlag 64 /* TELEPORT */) children.default) {normalizeChildren(vnode, children.default())return}// 子节点为 slotelse {type 32/* SLOTS_CHILDREN */const slotFlag children._if (!slotFlag !(InternalObjectKey in children)) {children._ctx currentRenderinglnstance}// 处理类型为 FORWARDED 的情况else if (slotFlag 3 /* FORWARDED */ currentRenderinglnstance) {// 动态插槽if (currentRenderingInstance.vnode.patchFlag 1024/* DYNAMIC_SLOTS */) {children._ 2/* DYNAMIC */vnode.patchFlag | 1024 /* DYNAMIC SLOTS */}// 静态插槽else {children._ 1/* STABLE */}}}}// 子节点为函数else if (isFunction(children)) {children { default: children, _ctx: currentRenderinglnstance }type 32/* SLOTS_CHILDREN */}// 其他子节点else {children String(children)// teleport 类型if (shapeFlag 64/* TELEPORT */) {type 16/* ARRAY_CHILDREN */children [createTextVNode(children)]}// 文本类型else {type 8/* TEXT_CHILDREN */}}vnode.children childrenvnode.shapeFlag | type }/*** 初始化 Slots*/ const initSlots (instance, children) {if (instance.vnode.shapeFlag 32/* SLOTS_CHILDREN */) {const type children._if (type) {instance.slots childrendef(children, _, type)} else {normalizeObjectSlots(children, (instance.slots {}))}} else {instance.slots {}if (children) {normalizeVNodeSlots(instance, children)}}def(instance.slots, InternalObjectKey, 1) }/*** 渲染 slot DOM* param {Object} slots - 插槽对象 instance.slots* param {string} name - 插槽名*/ function renderSlot(slots, name, props {}, fallback) {// 根据 name 获取对应插槽函数let slot slots[name]// 通过 createBlock 创建 vnode 节点类型为 Fragmentchildren 是执行 slot 插槽函数的返回值return (openBlock(), createBlock(Fragment, { key: props.key }, slot ? slot(props) : fallback ? fallback() : [], slots._ 1/* STABLE */ ? 64/* STABLE_FRAGMENT */ : -2/* BAIL */)); }/*** 保证子组件中渲染具体插槽内容保证它的数据作用域也是父组件*/ function withCtx(fn, ctx currentRenderinglnstance) {if (!ctx) return fnreturn function renderFnWithContext() {// 保存当前渲染的组件实例 ownerconst owner currentRenderingInstance// 把 ctx 设置为当前渲染的实例setCurrentRenderinglnstance(ctx)// 执行 fnconst res fn.apply(null, arguments)// 把 ctx 设置为当前渲染的实例setCurrentRenderingInstance(owner)return res} }/*** 处理 Fragment*/ const processFragment (nl, n2, container, anchor, parentComponent, parentSuspense, isSVG, optimized) {const fragmentStartAnchor (n2.el n1 ? nl.el : hostCreateText())const fragmentEndAnchor (n2.anchor n1 ? nl.anchor : hostCreateText())let { patchFlag } n2if (patchFlag 0) {optimized true}// 插入节点if (n1 null) {// 先在前后插入两个空文本节点hostInsert(fragmentStartAnchor, container, anchor)hostInsert(fragmentEndAnchor, container, anchor)// 再挂载子节点mountChildren(n2.children, container, fragmentEndAnchor, parentComponent, parentSuspense, isSVG, optimized)}//更新节点else { } }
http://www.pierceye.com/news/403988/

相关文章:

  • 用QQ群做网站排名交互式网站app
  • 正规免费发布信息网站国外网站界面
  • 浏览国外网站 dns网店运营推广方案
  • wordpress弹幕视频插件广西seo搜索引擎优化
  • 网站开发与维护工资多少网络公司排名兴田德润
  • wordpress主题ux壹搜网站建设优化排名
  • 试剂产品商城网站建设杭州网站现场备案
  • 高唐企业建网站服务商wordpress google
  • 重庆网站开发商城最近新闻有哪些
  • 电商网站设计线路图有哪些网络推广平台
  • 海门市建设局网站科技与应用
  • 北京做网站s免费做app网站有哪些
  • 免费制作网页的网站网络营销师报名官网
  • 长沙网站制作好公司网络服务模型
  • 网站开发的时间流程微信平台可以做微网站吗
  • 镇江网站seo天猫网店代运营
  • 吴江城乡住房和城乡建设局网站怎么给别人做网站优化
  • 名师工作室网站建设 意义网站图片上浮动文字
  • 做co的网站商城网站不备案
  • 黄山建设网站公司电话网站下载链接怎么做
  • 开发企业网站多少钱电视剧排行榜百度搜索风云榜
  • 什么网站做软文装修公司报价如何计算
  • 网站开发免费视频播放器应用公园app免费制作
  • 道路建设去什么网站能看到做内贸注册什么网站
  • 代理东莞网站制作公司wordpress前台用户中心代码
  • 做拼团网站下载wap浏览器
  • 网站建设合同文百科阿里云加WordPress建站
  • 服装购物网站排名ppt制作神器
  • 长沙营销策划公司排名如何优化企业网站
  • 北京制卡厂家做卡公司北京制卡网站_北京制卡_北京 去114网wordpress 关闭注册