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

做同城服务网站比较成功的网站wordpress 首页显示分类

做同城服务网站比较成功的网站,wordpress 首页显示分类,都匀网站建设公司,湛江制作网站企业Vue 3 的 diff 算法相较于 Vue 2 有了一些改进和优化#xff0c;主要是为了应对更复杂的组件结构和更高的性能需求。 以下是 Vue 3 diff 算法在处理列表更新时的大致步骤#xff1a; 头头比较#xff1a;首先#xff0c;比较新旧列表的头节点#xff08;即第一个节点主要是为了应对更复杂的组件结构和更高的性能需求。 以下是 Vue 3 diff 算法在处理列表更新时的大致步骤 头头比较首先比较新旧列表的头节点即第一个节点。如果它们相同基于 key 判断则复用该节点并移动两个列表的头指针到下一个节点。 尾尾比较然后比较新旧列表的尾节点即最后一个节点。如果它们相同也复用该节点并移动两个列表的尾指针到前一个节点。 移动或创建节点如果头头比较和尾尾比较都没有找到可复用的节点Vue 会尝试在旧列表中查找与新节点匹配的节点。如果找到了则移动该节点到正确的位置如果没有找到则创建一个新节点。 删除节点最后检查旧列表中是否有剩余的节点没有被复用或移动。如果有说明这些节点在新列表中不再需要因此将它们从 DOM 中删除。 前置节点后置节点比对 前置节点头头比较 比较新旧列表的头节点即第一个节点。如果它们相同基于 key 判断则复用该节点并移动两个列表的头指针到下一个节点。 // 1. sync from start// (a b) c// (a b) d e// 处理相同的前置节点while (i e1 i e2) {// 获取索引为 i 的 新老节点 n1 和 n2const n1 c1[i]const n2 (c2[i] optimized? cloneIfMounted(c2[i] as VNode): normalizeVNode(c2[i]))// 判断n1和n2新老节点相同的话进行节点的更新操作if (isSameVNodeType(n1, n2)) {patch(n1,n2,container,null,parentComponent,parentSuspense,namespace,slotScopeIds,optimized,)} else {// n1 和 n2 不是相同节点话前置节点的处理结束break}// 循环比对下一对前置节点i} 后置节点尾尾比较 比较新旧列表的尾节点即最后一个节点。如果它们相同也复用该节点并移动两个列表的尾指针到前一个节点。 // 2. sync from end// a (b c)// d e (b c)// 处理相同的后置节点while (i e1 i e2) {// 从最后的节点开始查找获取的相关节点n1 和 n2const n1 c1[e1]const n2 (c2[e2] optimized? cloneIfMounted(c2[e2] as VNode): normalizeVNode(c2[e2]))// 如果 n1 和 n2 是相同类型节点的话则进行节点的更新操作if (isSameVNodeType(n1, n2)) {patch(n1,n2,container,null,parentComponent,parentSuspense,namespace,slotScopeIds,optimized,)} else {// 当n1 和 n2 两个新老节点不相同时处理结束break}e1--e2--} 当比对完前置节点和后置节点后记录e1、e2、i这三个值后面需要用到 仅有新增节点 在第一步和第二步处理完前后置节点如果新节点中是仅有新增节点 源码解析 根据上图当 i e1 并且 i e2 就是仅有新增节点 // 仅有新增节点 当新节点和旧节点对比时发现新节点仅有新增节点只需要将新的节点遍历挂载到新的节点树上if (i e1) {if (i e2) {const nextPos e2 1const anchor nextPos l2 ? (c2[nextPos] as VNode).el : parentAnchorwhile (i e2) {patch(null,(c2[i] optimized? cloneIfMounted(c2[i] as VNode): normalizeVNode(c2[i])),container,anchor,parentComponent,parentSuspense,namespace,slotScopeIds,optimized,)i}}} 仅有卸载节点 在第一步和第二步处理完前后置节点如果新节点中是仅有卸载节点 源码解析 根据上图当 i e2 并且 i e1 就是仅有卸载节点 // 仅有卸载节点else if (i e2) {while (i e1) {unmount(c1[i], parentComponent, parentSuspense, true)i}}乱序的节点 源码解析 else {const s1 i // prev starting index 旧节点索引const s2 i // next starting index 新节点索引// 5.1 build key:index map for newChildren// 新节点位置映射表, 在前后置节点比较完的中间其余节点都拿出来放在这个表中const keyToNewIndexMap: Mapstring | number | symbol, number new Map()for (i s2; i e2; i) {const nextChild (c2[i] optimized? cloneIfMounted(c2[i] as VNode): normalizeVNode(c2[i]))if (nextChild.key ! null) {if (__DEV__ keyToNewIndexMap.has(nextChild.key)) {warn(Duplicate keys found during update:,JSON.stringify(nextChild.key),Make sure keys are unique.,)}keyToNewIndexMap.set(nextChild.key, i)}}// 5.2 loop through old children left to be patched and try to patch// matching nodes remove nodes that are no longer presentlet jlet patched 0// 新节点与旧节点对比后需要变更的数量const toBePatched e2 - s2 1// 移动标识let moved false// used to track whether any node has moved// 当前最远位置let maxNewIndexSoFar 0// works as MapnewIndex, oldIndex// Note that oldIndex is offset by 1// and oldIndex 0 is a special value indicating the new node has// no corresponding old node.// used for determining longest stable subsequence// 新旧节点位置映射表默认值新节点需要处理的个数const newIndexToOldIndexMap new Array(toBePatched)for (i 0; i toBePatched; i) newIndexToOldIndexMap[i] 0for (i s1; i e1; i) {const prevChild c1[i]if (patched toBePatched) {// all new children have been patched so this can only be a removalunmount(prevChild, parentComponent, parentSuspense, true)continue}let newIndexif (prevChild.key ! null) {// 从新节点位置映射表中找旧节点映射值newIndex keyToNewIndexMap.get(prevChild.key)} else {// key-less node, try to locate a key-less node of the same typefor (j s2; j e2; j) {if (newIndexToOldIndexMap[j - s2] 0 isSameVNodeType(prevChild, c2[j] as VNode)) {newIndex jbreak}}}if (newIndex undefined) {// 当旧节点在新节点位置映射表中没有找到直接卸载unmount(prevChild, parentComponent, parentSuspense, true)} else {// 当旧节点在新节点位置映射表中找到更改新旧节点映射表中的值newIndexToOldIndexMap[newIndex - s2] i 1// if (newIndex maxNewIndexSoFar) {maxNewIndexSoFar newIndex} else {moved true}patch(prevChild,c2[newIndex] as VNode,container,null,parentComponent,parentSuspense,namespace,slotScopeIds,optimized,)patched}}// 5.3 move and mount// generate longest stable subsequence only when nodes have movedconst increasingNewIndexSequence moved? getSequence(newIndexToOldIndexMap): EMPTY_ARRj increasingNewIndexSequence.length - 1// looping backwards so that we can use last patched node as anchorfor (i toBePatched - 1; i 0; i--) {const nextIndex s2 iconst nextChild c2[nextIndex] as VNodeconst anchor nextIndex 1 l2 ? (c2[nextIndex 1] as VNode).el : parentAnchorif (newIndexToOldIndexMap[i] 0) {// mount newpatch(null,nextChild,container,anchor,parentComponent,parentSuspense,namespace,slotScopeIds,optimized,)} else if (moved) {// move if:// There is no stable subsequence (e.g. a reverse)// OR current node is not among the stable sequenceif (j 0 || i ! increasingNewIndexSequence[j]) {move(nextChild, container, anchor, MoveType.REORDER)} else {j--}}}}
文章转载自:
http://www.morning.mhnd.cn.gov.cn.mhnd.cn
http://www.morning.wwxg.cn.gov.cn.wwxg.cn
http://www.morning.lfcfn.cn.gov.cn.lfcfn.cn
http://www.morning.jqtb.cn.gov.cn.jqtb.cn
http://www.morning.kdxzy.cn.gov.cn.kdxzy.cn
http://www.morning.gnjkn.cn.gov.cn.gnjkn.cn
http://www.morning.tgyqq.cn.gov.cn.tgyqq.cn
http://www.morning.tmzlt.cn.gov.cn.tmzlt.cn
http://www.morning.bjjrtcsl.com.gov.cn.bjjrtcsl.com
http://www.morning.kbdrq.cn.gov.cn.kbdrq.cn
http://www.morning.wwdlg.cn.gov.cn.wwdlg.cn
http://www.morning.fhjnh.cn.gov.cn.fhjnh.cn
http://www.morning.ldpjm.cn.gov.cn.ldpjm.cn
http://www.morning.kngqd.cn.gov.cn.kngqd.cn
http://www.morning.wknj.cn.gov.cn.wknj.cn
http://www.morning.kqpq.cn.gov.cn.kqpq.cn
http://www.morning.bsxws.cn.gov.cn.bsxws.cn
http://www.morning.bprsd.cn.gov.cn.bprsd.cn
http://www.morning.skrcn.cn.gov.cn.skrcn.cn
http://www.morning.fplqh.cn.gov.cn.fplqh.cn
http://www.morning.bygyd.cn.gov.cn.bygyd.cn
http://www.morning.i-bins.com.gov.cn.i-bins.com
http://www.morning.nmtyx.cn.gov.cn.nmtyx.cn
http://www.morning.msbpb.cn.gov.cn.msbpb.cn
http://www.morning.kndst.cn.gov.cn.kndst.cn
http://www.morning.qllcm.cn.gov.cn.qllcm.cn
http://www.morning.ndhxn.cn.gov.cn.ndhxn.cn
http://www.morning.dswtz.cn.gov.cn.dswtz.cn
http://www.morning.ddqdl.cn.gov.cn.ddqdl.cn
http://www.morning.qkrgk.cn.gov.cn.qkrgk.cn
http://www.morning.wqtzs.cn.gov.cn.wqtzs.cn
http://www.morning.fnpyk.cn.gov.cn.fnpyk.cn
http://www.morning.hlppp.cn.gov.cn.hlppp.cn
http://www.morning.crxdn.cn.gov.cn.crxdn.cn
http://www.morning.mzwqt.cn.gov.cn.mzwqt.cn
http://www.morning.lswgs.cn.gov.cn.lswgs.cn
http://www.morning.qytpt.cn.gov.cn.qytpt.cn
http://www.morning.smggx.cn.gov.cn.smggx.cn
http://www.morning.qcygd.cn.gov.cn.qcygd.cn
http://www.morning.rjfr.cn.gov.cn.rjfr.cn
http://www.morning.sjwqr.cn.gov.cn.sjwqr.cn
http://www.morning.krbjb.cn.gov.cn.krbjb.cn
http://www.morning.qpmwb.cn.gov.cn.qpmwb.cn
http://www.morning.hlkxb.cn.gov.cn.hlkxb.cn
http://www.morning.ntqjh.cn.gov.cn.ntqjh.cn
http://www.morning.qczjc.cn.gov.cn.qczjc.cn
http://www.morning.pmbcr.cn.gov.cn.pmbcr.cn
http://www.morning.xckrj.cn.gov.cn.xckrj.cn
http://www.morning.qrzwj.cn.gov.cn.qrzwj.cn
http://www.morning.hbtarq.com.gov.cn.hbtarq.com
http://www.morning.cwwbm.cn.gov.cn.cwwbm.cn
http://www.morning.pcqdf.cn.gov.cn.pcqdf.cn
http://www.morning.hphrz.cn.gov.cn.hphrz.cn
http://www.morning.skbhl.cn.gov.cn.skbhl.cn
http://www.morning.gypcr.cn.gov.cn.gypcr.cn
http://www.morning.zwtp.cn.gov.cn.zwtp.cn
http://www.morning.ykwbx.cn.gov.cn.ykwbx.cn
http://www.morning.gjcdr.cn.gov.cn.gjcdr.cn
http://www.morning.mkydt.cn.gov.cn.mkydt.cn
http://www.morning.cxtbh.cn.gov.cn.cxtbh.cn
http://www.morning.ymyhg.cn.gov.cn.ymyhg.cn
http://www.morning.pbmg.cn.gov.cn.pbmg.cn
http://www.morning.ghrlx.cn.gov.cn.ghrlx.cn
http://www.morning.trjr.cn.gov.cn.trjr.cn
http://www.morning.tmfm.cn.gov.cn.tmfm.cn
http://www.morning.mbpzw.cn.gov.cn.mbpzw.cn
http://www.morning.zpzys.cn.gov.cn.zpzys.cn
http://www.morning.mntxalcb.com.gov.cn.mntxalcb.com
http://www.morning.bnfsw.cn.gov.cn.bnfsw.cn
http://www.morning.rlns.cn.gov.cn.rlns.cn
http://www.morning.jsxrm.cn.gov.cn.jsxrm.cn
http://www.morning.kyjpg.cn.gov.cn.kyjpg.cn
http://www.morning.aiai201.cn.gov.cn.aiai201.cn
http://www.morning.ctbr.cn.gov.cn.ctbr.cn
http://www.morning.bgygx.cn.gov.cn.bgygx.cn
http://www.morning.nrrzw.cn.gov.cn.nrrzw.cn
http://www.morning.kgjyy.cn.gov.cn.kgjyy.cn
http://www.morning.bpwz.cn.gov.cn.bpwz.cn
http://www.morning.yfwygl.cn.gov.cn.yfwygl.cn
http://www.morning.bmyrl.cn.gov.cn.bmyrl.cn
http://www.tj-hxxt.cn/news/239736.html

相关文章:

  • 哪位大神推荐一下好网站澄海网站建设公司
  • 温州网站建帝国cms 网站地图 xml
  • 管理网站英文广州网站建设海珠信科
  • 网站背景更换wordpress打包app
  • 东莞网页制作免费网站制作摄影师招聘网站
  • 枣强网址建站婚纱定制网站哪个好
  • 百度推广移动端网站百姓装潢上海门店具体地址
  • 商城网站如何优化电商网站做互联网金融
  • 商城类网站建设需要多少钱廊坊网站建设团队
  • 西安优秀的定制网站建设公司哪家好网址缩短链接在线工具
  • 广州海珠网站设计北京市网站制作设计
  • 网站建设怎么搞银川手机网站建设
  • 郑州市的实惠推广网站wordpress空间清理
  • 东南亚做棋牌网站上海自聊自做网站
  • 海外网站如何做用户实名认证网站搭建网
  • 福州企业网站模板建站如何制作网站的步骤
  • 《网站建设方案》在北京网站建设的岗位
  • 企业网站模板下载需谨慎中国兰州网
  • 做网投网站好wordpress 源码讲解
  • 非模板网站水果网店网站建设策划书
  • 万网备案网站名称wordpress怎么注册用户
  • 厦门市建设局综合业务平台网站开一个网站的流程
  • 常州微信网站建设市场wordpress 分类文章置顶插件
  • 农安县建设局官方网站网站子站建设
  • php 调试网站建设企业官方网站
  • 免费浏览外国网站的软件中国旅游网站排名
  • 网站开发 入门教程网站首页风格
  • 如何推荐别人做网站数商云商城
  • 网站分享图片怎么做博客网站模板
  • 建行业网站的必要性百度关键词收录排名