From b1b2b387fd6d68c9db8516b9560d9dfa4ce964b8 Mon Sep 17 00:00:00 2001
From: KumJungMin <37934668+KumJungMin@users.noreply.github.com>
Date: Tue, 13 Feb 2024 14:01:31 +0900
Subject: [PATCH 1/2] Update watchers.md
add once option description on watcher
---
src/guide/essentials/watchers.md | 35 ++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/src/guide/essentials/watchers.md b/src/guide/essentials/watchers.md
index 6caa3652ea..addf3d62ea 100644
--- a/src/guide/essentials/watchers.md
+++ b/src/guide/essentials/watchers.md
@@ -272,6 +272,41 @@ watch(
+
+## Once Watchers {#once-watchers}
+
+Watcher's callback will execute whenever the watched source changes. If you want the callback to trigger only once when the source changes, use the `once: true` option.
+
+
+
+```js
+export default {
+ watch: {
+ source: {
+ handler(newValue, oldValue) {
+ // when `source` changes, triggers only once
+ },
+ once: true
+ }
+ }
+}
+```
+
+
+
+
+```js
+watch(
+ source,
+ (newValue, oldValue) => {
+ // when `source` changes, triggers only once
+ },
+ { once: true }
+)
+```
+
+
+
## `watchEffect()` \*\* {#watcheffect}
From ea75c4e6e81055da89dfebad63ed024a372036f3 Mon Sep 17 00:00:00 2001
From: KumJungMin <37934668+KumJungMin@users.noreply.github.com>
Date: Tue, 13 Feb 2024 14:07:15 +0900
Subject: [PATCH 2/2] docs: column spacing
---
src/guide/essentials/watchers.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/guide/essentials/watchers.md b/src/guide/essentials/watchers.md
index addf3d62ea..9a290282cd 100644
--- a/src/guide/essentials/watchers.md
+++ b/src/guide/essentials/watchers.md
@@ -291,6 +291,7 @@ export default {
}
}
```
+