From 283dcd90cda60743dab3036640e45d56c8825e7a Mon Sep 17 00:00:00 2001 From: Jerald Vinfrank <46400789+JeraldVin@users.noreply.github.com> Date: Sun, 20 Nov 2022 23:37:07 +0530 Subject: [PATCH 1/2] fix(docs): update example code for watch() The 1st argument for watch() should be a ref/reactive/getter function/array of ref, reactive, getter function. But in the example code, the watch callback has been used as the 1st argument --- docs/rules/no-setup-props-destructure.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/rules/no-setup-props-destructure.md b/docs/rules/no-setup-props-destructure.md index 0048bc6e0..4bc7b3292 100644 --- a/docs/rules/no-setup-props-destructure.md +++ b/docs/rules/no-setup-props-destructure.md @@ -22,7 +22,7 @@ This rule reports the destructuring of `props` passed to `setup` causing the val export default { /* ✓ GOOD */ setup(props) { - watch(() => { + watch(() => props.count, () => { console.log(props.count) }) @@ -45,8 +45,8 @@ Destructuring the `props` passed to `setup` will cause the value to lose reactiv export default { /* ✗ BAD */ setup({ count }) { - watch(() => { - console.log(count) // not going to detect changes + watch(() => count, () => { // not going to detect changes + console.log(count) }) return () => { @@ -69,8 +69,8 @@ export default { setup(props) { /* ✗ BAD */ const { count } = props - - watch(() => { + + watch(() => props.count, () => { /* ✓ GOOD */ const { count } = props console.log(count) From a577251dd4dde80c25bd76f1c0ba8fbf941277c0 Mon Sep 17 00:00:00 2001 From: Jerald Vinfrank <46400789+JeraldVin@users.noreply.github.com> Date: Sun, 20 Nov 2022 23:40:10 +0530 Subject: [PATCH 2/2] chore: remove extra space --- docs/rules/no-setup-props-destructure.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rules/no-setup-props-destructure.md b/docs/rules/no-setup-props-destructure.md index 4bc7b3292..8db330355 100644 --- a/docs/rules/no-setup-props-destructure.md +++ b/docs/rules/no-setup-props-destructure.md @@ -69,7 +69,7 @@ export default { setup(props) { /* ✗ BAD */ const { count } = props - + watch(() => props.count, () => { /* ✓ GOOD */ const { count } = props