From 70575402eb14a2d67b20d2d66d9f982ce5c56e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20G=C5=82owala?= Date: Mon, 25 Nov 2024 19:46:16 +0100 Subject: [PATCH 1/2] docs: correct usage examples of `useTemplateRef` (#3031) --- src/guide/typescript/composition-api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/guide/typescript/composition-api.md b/src/guide/typescript/composition-api.md index 1c4fac226..8cf6978c0 100644 --- a/src/guide/typescript/composition-api.md +++ b/src/guide/typescript/composition-api.md @@ -376,7 +376,7 @@ Vue 3.5 と `@vue/language-tools` 2.1(IDE の言語サービスと `vue-tsc` 自動推論が不可能な場合でも、ジェネリック引数を使用してテンプレート参照を明示的な型にキャストすることができます: ```ts -const el = useTemplateRef(null) +const el = useTemplateRef('el') ```
@@ -438,7 +438,7 @@ const compRef = useTemplateRef('comp') import { useTemplateRef } from 'vue' import type { ComponentPublicInstance } from 'vue' -const child = useTemplateRef(null) +const child = useTemplateRef('child') ``` 参照されるコンポーネントが[ジェネリックコンポーネント](/guide/typescript/overview.html#generic-components)の場合、例えば `MyGenericModal` の場合: @@ -467,7 +467,7 @@ import { useTemplateRef } from 'vue' import MyGenericModal from './MyGenericModal.vue' import type { ComponentExposed } from 'vue-component-type-helpers' -const modal = useTemplateRef>(null) +const modal = useTemplateRef>('modal') const openModal = () => { modal.value?.open('newValue') From 775c709f562a2085892818829f8ba78661852033 Mon Sep 17 00:00:00 2001 From: "@beer" <47961062+iiio2@users.noreply.github.com> Date: Tue, 26 Nov 2024 00:31:07 +0600 Subject: [PATCH 2/2] docs(computed): remove semicolons (#3117) --- src/guide/essentials/computed.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/guide/essentials/computed.md b/src/guide/essentials/computed.md index ef3378955..8d8b9999c 100644 --- a/src/guide/essentials/computed.md +++ b/src/guide/essentials/computed.md @@ -281,10 +281,10 @@ export default { // 条件を満たした最後の値が代わりに返されます alwaysSmall(previous) { if (this.count <= 3) { - return this.count; + return this.count } - return previous; + return previous } } } @@ -304,10 +304,10 @@ const count = ref(2) // 条件を満たした最後の値が代わりに返されます const alwaysSmall = computed((previous) => { if (count.value <= 3) { - return count.value; + return count.value } - return previous; + return previous }) ``` @@ -328,13 +328,13 @@ export default { alwaysSmall: { get(previous) { if (this.count <= 3) { - return this.count; + return this.count } return previous; }, set(newValue) { - this.count = newValue * 2; + this.count = newValue * 2 } } } @@ -353,13 +353,13 @@ const count = ref(2) const alwaysSmall = computed({ get(previous) { if (count.value <= 3) { - return count.value; + return count.value } - return previous; + return previous }, set(newValue) { - count.value = newValue * 2; + count.value = newValue * 2 } })