Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update template refs render function * docs: update template refs render function * chore: remove sample * Update src/guide/extras/render-function.md resolved conversation Co-authored-by: Natalia Tepluhina <[email protected]> --------- Co-authored-by: Natalia Tepluhina <[email protected]> (#207) #208

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/component-instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

```ts
interface ComponentPublicInstance {
$el: Node | undefined
$el: any
}
```

Expand Down
6 changes: 6 additions & 0 deletions src/api/options-lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

- <sup class="vt-badge" data-text="SSR only"></sup> Replacing errored child component in parent component deep inside `<Suspense>` 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 <sup class="vt-badge dev-only" /> {#rendertracked}

يستدعى عندما يتم تتبع اعتمادية تفاعلية بواسطة تأثير تصيير المكون.
Expand Down
15 changes: 15 additions & 0 deletions src/guide/extras/render-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')

// <div ref="divEl">
return () => h('div', { ref: 'my-div' })
}
}
```

</div>
<div class="options-api">

Expand Down