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

wordpress post slug codex技术优化seo

wordpress post slug codex,技术优化seo,红包打赏的网站怎么做,佛山企业网站排名优化开篇 因最近工作中遇到了无分页情景下页面因大数据量卡顿的问题&#xff0c;在分别考虑并尝试了懒加载、虚拟滚动、分批渲染等各个方法后&#xff0c;最后决定使用分批渲染来解决该问题。 代码实现 表格代码 <el-table :data"currTableData"borderstyle"wi…

开篇

因最近工作中遇到了无分页情景下页面因大数据量卡顿的问题,在分别考虑并尝试了懒加载、虚拟滚动、分批渲染等各个方法后,最后决定使用分批渲染来解决该问题。

代码实现

表格代码

<el-table :data="currTableData"borderstyle="width: 100%;":max-height="getMaxHeight()":cell-style="CellStyle" @cell-click="handleCellClick"
><!--姓名列--><el-table-column style="background-color: #fff;":align="'center'"prop="userName"label="姓名"width="80"fixed/><!--工号--><el-table-column v-for="(item, index) in filteredCfgColumns":key="index"style="background-color: #fff;":align="'center'":prop="item.prop":label="item.label"/><!--这一块牵扯到合并列及周期模式切换后的动态展示需要特殊处理,不要写死--><el-table-column v-for="(date, index) in dateHeaders" :key="index" :align="'center'":class-name="isWeekend(date)":label-class-name="isWeekend(date)":width="getColumnWidth()"><!--星期几/日期--><template #header><div>{{ getWeekDay(date) }}</div><div>{{ parseDate(date) }}</div></template><!--表格内容 --><template #default="{row}"><div class="cell-content"v-if="row[date]":data-cell-content="JSON.stringify(row[date])":class="`${row[date].cellKey}`"><!-- 第一行 --><div v-if="pageSettingList.includes('显示附加班')" class="row"style="font-size: 8px;min-height: 12px; display: flex; align-items: center;"><el-row style="width: 100%;"><el-col :span="24" style="color: red;font-weight: 600;text-align: right;">{{ row[date]?.attchDetail || '' }}</el-col></el-row></div><!-- 第二行 --><div class="row"style="font-size: 10px;min-height: 20px; display: flex; align-items: center;white-space: nowrap;overflow: hidden;"><el-row style="width: 100%;"><el-col :span="24" style="font-weight: 600;text-align: center;"><StyledText :colorAndSchedules="colorAndSchedules":styledTexts="row[date]?.mainDetail || ''" /></el-col></el-row></div><!-- 第三行 --><div class="row"style="font-size: 8px;min-height: 12px; display: flex; align-items: center;"><el-row style="width: 100%;"><el-col :span="6" v-if="pageSettingList.includes('显示上期排班')"style="display: block;text-align: left;font-weight: 600;color: green;">{{ 'A1' }}</el-col><el-col :span="12" v-if="pageSettingList.includes('显示申请班')"style="display: block;text-align: center;font-weight: 600;color: green;">{{ row[date]?.applyDetail || '' }}</el-col><el-col :span="6" style="display: block;text-align: left;font-weight: 600;color: green;">  <div class="tip-con"><el-tooltipstyle="position: absolute!important; right: 0;bottom: 0; color: red; font-size: 12px;" placement="top" v-if="isShowRemark(row[date]?.remarkInfo)"><template #content><el-table :data="row[date]?.remarkInfo" style="width: 100%"><el-table-column prop="shifts" label="班次名" width="180" /><el-table-column prop="remark" label="备注" width="180" /><el-table-column prop="type" label="班次类型" /></el-table></template><el-icon><InfoFilled /></el-icon></el-tooltip></div></el-col></el-row></div>                                 </div></template></el-table-column>
</el-table>

分批渲染逻辑代码

  • 定义变量
 startIndex: 0, //开始索引,用于分批渲染的batchSize: 6, // 一次性渲染的条数
  • 分批渲染方法
const currTableData = ref([])const loadBatch = () => {if (state.startIndex < props.tableData.length) {const endIndex = Math.min(state.startIndex + state.batchSize, props.tableData.length);currTableData.value = currTableData.value.concat(props.tableData.slice(state.startIndex, endIndex));state.startIndex = endIndex;requestAnimationFrame(loadBatch);} 
}watch(() => props.tableData, newData => {currTableData.value = []; // 重置数据state.startIndex = 0;loadBatch()
}, { immediate: true })

效果

在这里插入图片描述在这里插入图片描述

上面便是分批渲染表格的具体实现方式,可以看到这个表格是相当复杂的,哪怕是使用了分批渲染,第一次也用了6秒多的时间,可想而知如果一次性渲染几百行几千行,消耗的时间肯定会大大影响用户体验。当然,这种页面性能的优化不仅仅分批渲染一种手段,后面我会持续探索,如果有了新的手段,也会总结成文的。
感谢阅读!

http://www.tj-hxxt.cn/news/35283.html

相关文章:

  • 组建公司网络方案外贸seo推广
  • 做防水施工 上什么网站找网站推广软件哪个好
  • 网站开发模块查相似北京搜索优化排名公司
  • html5 网站框架网络营销服务外包
  • 做网站搞友情链接百度搜索引擎优化的方法
  • 做网站需要准备的东西刷外链工具
  • 网站客服怎么做的百度官网下载安装免费
  • 找人给公司做网站去哪找宁波seo推广外包公司
  • 做网站信科网站建设优化设计的答案
  • wordpress 文件管理器seo服务指什么意思
  • 越秀区营销型网站建设国内设计公司前十名
  • ui设计师岗位介绍杭州seo网站哪家好
  • 南宁庆云网站建设企业网络营销的模式有哪些
  • 高端品牌网站建设制作多少钱网络推广的方法和技巧
  • 建立网站建站程序网络软文名词解释
  • 自己dreamweaver做的网站怎么挂长沙企业seo优化
  • 响应式网站开发现状南宁seo平台标准
  • 常州 网站优化推文关键词生成器
  • 自己电脑做服务器上传网站 需要备案吗做广告的怎么找客户
  • 专门做微信公众号的网站百度账户代运营
  • 平谷做网站手机免费建站系统
  • 国内做电商网站今天的新闻内容
  • 怎么做bt爬虫网站网站搜索关键词优化
  • 中小企业网站建设网页设计图
  • 网站开发需要用到哪些技术网络营销模式
  • 北京网站关键词排名推广百度收录提交网站后多久收录
  • 邢台做网站咨询青海网站seo
  • 有没有网站教育机构在线咨询
  • 做网站公司 上海代引流推广公司
  • 网站后台卸载cmsdede谷歌seo服务商