当前位置:网站首页>新增指令 v-memo
新增指令 v-memo
2022-08-02 19:48:00 【大象与小蚂蚁的生活】
v-memod会记住一个模板的子树,元素和组件上都可以使用。
该指令接收一个固定长度的数组作为依赖值进行[记忆比对]。
如果数组中的每个值都和上次渲染的时候相同,则整个子树的更新会被跳过。
即使是虚拟 DOM 的 VNode 创建也将被跳过,因为子树的记忆副本可以被重用。
因此渲染的速度会非常的快。
需要注意得是:正确地声明记忆数组是很重要。
开发者有责任指定正确的依赖数组,以避免必要的更新被跳过。
<li v-for="item in listArr" :key="item.id" v-memo="['valueA','valueB']">
{
{
item.name }}
</li>
v-memod的指令使用较少,它的作用是:缓存模板中的一部分数据。
只创建一次,以后就不会再更新了。也就是说用内存换取时间。
边栏推荐
猜你喜欢

A Review of Nature Microbiology: Focusing on the Algae--Ecological Interface of Phytoplankton-Bacteria Interactions

LeetCode:622. 设计循环队列【模拟循环队列】

el-tree渲染大量数据的解决方案(不通过懒加载)

Brain-computer interface 003 | Musk said that he has realized a virtual self-dialogue with the cloud, and related concept shares have risen sharply

GNN教程:图神经网络基础知识!

解析Collection接口中的常用的被实现子类重写的方法

VMware虚拟机无法上网

2022-07-26

SQL Server安装教程

Leetcode刷题——单调栈问题(739每日温度问题、496下一个更大元素I、503下一个更大元素 II)
随机推荐
【数据分析】:什么是数据分析?
实现客户服务自助,打造产品知识库
日志框架学习
MaxCompute 近期发布上线的版本的 SQL 引擎新功能参数化视图有什么优势?
Fetch 请求不转换BLOB正常显示GBK编码的数据
Redis cluster configuration
golang刷leetcode 数学(1) 丑数系列
基于 outline 实现头像剪裁以及预览
磁盘分区的知识
4 kmiles join YiSheng group, with more strong ability of digital business, accelerate China's cross-border electricity full domain full growth
【 LeetCode 】 1374. Generate each character string is an odd number
Redis集群配置
当TIME_WAIT状态的TCP正常挥手,收到SYN后…
Meta 与苹果的元宇宙碰撞
ShapeableImageView 的使用,告别shape、三方库
分享一个 web 应用版本监测 (更新) 的工具库
NC | Structure and function of soil microbiome reveal N2O release from global wetlands
Shell: conditional statements
golang刷leetcode 动态规划(13) 最长公共子序列
技术分享 | Apache Linkis 快速集成网页IDE工具 Scriptis