Tags → #Vue
-
考虑路由来源的 Vue 页面缓存逻辑
本文介绍了在Vue框架中实现页面缓存逻辑的两种方案。初版方案通过keep-alive和router-view结合使用,以及路由守卫来控制页面缓存,但存在逻辑复杂的问题。新方案简化了逻辑,通过构建目标页面和来源页面的关系,优化了缓存机制,使得代码更加简洁且易于理解。
-
Vue 组件的 Props 到底能不能改?
Vue 推崇单向数据流这个概念,也就是数据流向必须是从父到子。子组件想要修改数据必须 `emit` 一个事件,父组件接收到事件后,由父组件修改数据传回到子组件。 我在 stackblitz 写了个例子,使用版本为 `Vue@3.4.5`。可以看到在,`props` proxy 的外层 hand...
-
写 Vue 我建议非必要别用 watch
Vue 里的 watch 很好用,但是过度依赖 watch 真的好吗?
-
Vue 优化速查
我曾以为,拆分子组件只是用于抽象,但实践告诉我,拆分子组件是提升性能的一种方式。 在我的实际工作中遇到这么个问题,有一个很大的表格,里面有多个新增条目的对话框,当数据很多的时候,填写新增数据都会变卡。 原因就是,在一个组件里,修改值会造成整个组件的数据检查和 diff。但是明知道大表单什么都...
-
Vue's asynchronous update mechanism
This article mainly introduces the principles of Vue's asynchronous updates. The core understanding of this article is not difficult without the under...
-
El mecanismo de actualización asíncrona de Vue.
Este artículo se centra en los principios relacionados con las actualizaciones asíncronas en Vue. La comprensión central de este artículo no es tan di...
-
Vueの非同期更新メカニズム
この記事では、Vueの非同期更新に関連する原理について説明します。この記事の中心的な理解は、**キュー**という2つの単語です。 なぜ非同期更新が必要なのでしょうか? ```javascript this.a = 1; this.b = 2; this.c = 3; this.a = 5; ...
-
Vue 的异步更新机制
这篇文章主要介绍的就是 Vue 异步更新相关的原理。本篇的核心理解起来没有响应式原理难,重点就是两个字**队列**。 为什么需要异步更新? ```javascript this.a = 1; this.b = 2; this.c = 3; this.a = 5; this.a = 6; ``...