diff --git a/src/api/component-instance.md b/src/api/component-instance.md index cf9b7ef8..efb11c6e 100644 --- a/src/api/component-instance.md +++ b/src/api/component-instance.md @@ -42,7 +42,7 @@ ```ts interface ComponentPublicInstance { - $el: Node | undefined + $el: any } ``` diff --git a/src/api/options-lifecycle.md b/src/api/options-lifecycle.md index bdf7daad..a16c27ab 100644 --- a/src/api/options-lifecycle.md +++ b/src/api/options-lifecycle.md @@ -209,6 +209,12 @@ - يمكن لخطاف `()errorCaptured` أن يرجع `false` لمنع الخطأ من الانتشار أكثر. هذا يعني بشكل أساسي "تم التعامل مع هذا الخطأ ويجب تجاهله." سيمنع أي خطافات `()errorCaptured` إضافية أو `app.config.errorHandler` من الاستدعاء لهذا الخطأ. + **Error Capturing Caveats** + + - In components with async `setup()` function (with top-level `await`) Vue **will always** try to render component template, even if `setup()` throwed error. This will likely cause more errors because during render component's template might try to access non-existing properties of failed `setup()` context. When capturing errors in such components, be ready to handle errors from both failed async `setup()` (they will always come first) and failed render process. + + - Replacing errored child component in parent component deep inside `` will cause hydration mismatches in SSR. Instead, try to separate logic that can possibly throw from child `setup()` into separate function and execute it in the parent component's `setup()`, where you can safely `try/catch` the execution process and make replacement if needed before rendering the actual child component. + ## renderTracked {#rendertracked} يستدعى عندما يتم تتبع اعتمادية تفاعلية بواسطة تأثير تصيير المكون. diff --git a/src/guide/extras/render-function.md b/src/guide/extras/render-function.md index 2467eb35..9b29065f 100644 --- a/src/guide/extras/render-function.md +++ b/src/guide/extras/render-function.md @@ -676,6 +676,21 @@ export default { } ``` +or (with version >= 3.5) + +```js +import { h, useTemplateRef } from 'vue' + +export default { + setup() { + const divEl = useTemplateRef('my-div') + + //
+ return () => h('div', { ref: 'my-div' }) + } +} +``` +