---
title: "Discussion on \"三歲小朋友也能懂的 Vue watch 清理副作用 (clean up)\" | Hashnode"
description: "Discussion on \"三歲小朋友也能懂的 Vue watch 清理副作用 (clean up)\". 三歲小朋友也能懂的 Vue watch 清理副作用 (clean up)\n1. watch 是什麼？\n小朋友，你有沒有玩過「聽寫遊戲」呢？當老師說一個字，你就要寫下來對不對？\n在 Vue 裡，watch 就像是在「聽」一個變數的變化。只要變數變了，它就會「做一些事情」，例如去網路上抓新的圖片。\n2. 什麼是「過期的副作用」？\n現在想像一下，你在畫畫，老師叫你畫「小貓」，你開始畫。但畫到一半，老師又說：「換畫小狗！」然後又說：「換畫小兔子！」結果，你的畫紙上畫滿了不同動物，亂七八糟的，對吧？\n在 ..."
url: "https://hashnode.com/posts/vue-watch-clean-up/67b61fcc01d6008968693929"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [三歲小朋友也能懂的 Vue watch 清理副作用 (clean up)](https://sunpochin.hashnode.dev/vue-watch-clean-up?utm_source=hashnode&utm_medium=feed)

三歲小朋友也能懂的 Vue watch 清理副作用 (clean up) 1. watch 是什麼？ 小朋友，你有沒有玩過「聽寫遊戲」呢？當老師說一個字，你就要寫下來對不對？ 在 Vue 裡，watch 就像是在「聽」一個變數的變化。只要變數變了，它就會「做一些事情」，例如去網路上抓新的圖片。 2. 什麼是「過期的副作用」？ 現在想像一下，你在畫畫，老師叫你畫「小貓」，你開始畫。但畫到一半，老師又說：「換畫小狗！」然後又說：「換畫小兔子！」結果，你的畫紙上畫滿了不同動物，亂七八糟的，對吧？ 在 ...

Feb 19, 2025 · 2 min read · sunpochin.hashnode.dev  
Read the article

-   [#oninvalidate](https://hashnode.com/tag/oninvalidate)
-   [#vuejs](https://hashnode.com/tag/vuejs)
-   [#abortcontroller](https://hashnode.com/tag/abortcontroller)
-   [#vue-watch-vs-vue-watcheffect](https://hashnode.com/tag/vue-watch-vs-vue-watcheffect)

## Written by

[Sun Pochin](https://hashnode.com/@sunpochin)

@sunpochin · Taipei, Taiwan

  
[View profile](https://hashnode.com/@sunpochin)

Developer, building thins on web.

I was the main web front-end engineer responsible for developing and maintaining the customer-facing platform for WisdomHall (品學堂) in 2024 Q3 Q4, code reviewed by CTO and a senior engineer. http://learning.wisdomhall.com.tw has total active 257k users, according to their Facebook post: https://www.facebook.com/share/p/1MnjbwZxCV/ My tech stack includes JavaScript, Vue 2, Nuxt 2, git, and Docker.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
