当前位置:网站首页>新增指令 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的指令使用较少,它的作用是:缓存模板中的一部分数据。
只创建一次,以后就不会再更新了。也就是说用内存换取时间。
边栏推荐
猜你喜欢

一款好用的FAQ搭建工具

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

Thread线程类基本使用(下)

In action: 10 ways to implement delayed tasks, with code!

J9数字论:互联网跨链桥有什么作用呢?

Shell: conditional statements

如何ES源码中添加一个自己的API 流程梳理

ShardingSphere-proxy +PostgreSQL实现读写分离(静态策略)

光源控制器接口定义说明

MySQL安装配置教程(超级详细)
随机推荐
2022-07-26
openlayers version update difference
【 LeetCode 】 1374. Generate each character string is an odd number
让你的应用完美适配平板
云平台简介
【StoneDB性能相关工具】内存监控
The so-called fighting skill again gao also afraid of the chopper - partition, depots, table, and the merits of the distributed
日志框架学习
J9 Digital Currency Theory: Identifying Web3's New Scarcity: Open Source Developers
银保监会:人身险产品信披材料应由保险公司总公司统一负责管理
Lvm逻辑卷
Translate My Wonderful | July Moli Translation Program Winners Announced
A Review of Nature Microbiology: Focusing on the Algae--Ecological Interface of Phytoplankton-Bacteria Interactions
B站HR对面试者声称其核心用户都是生活中的Loser
In action: 10 ways to implement delayed tasks, with code!
leetcode刷题记录:7.整数反转,8.字符串转整数,9.回文数
ShardingSphere-proxy +PostgreSQL implements read-write separation (static strategy)
SQL Server安装教程
TPAMI2022 | TransCL:基于Transformer的压缩学习,更灵活更强大
2022-08-01