docs: Change render function's return type (#27229)

This commit is contained in:
迷渡 2025-03-21 12:48:22 +08:00 committed by GitHub
parent cf7d639fbc
commit 962709f42c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -42,7 +42,7 @@ To bind actions, chain `on_action` on to your element:
```rust ```rust
impl Render for Menu { impl Render for Menu {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl Component { fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
div() div()
.on_action(|this: &mut Menu, move: &MoveUp, window: &mut Window, cx: &mut Context<Menu>| { .on_action(|this: &mut Menu, move: &MoveUp, window: &mut Window, cx: &mut Context<Menu>| {
// ... // ...
@ -59,7 +59,7 @@ In order to bind keys to actions, you need to declare a _key context_ for part o
```rust ```rust
impl Render for Menu { impl Render for Menu {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl Component { fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
div() div()
.key_context("menu") .key_context("menu")
.on_action(|this: &mut Menu, move: &MoveUp, window: &mut Window, cx: &mut Context<Menu>| { .on_action(|this: &mut Menu, move: &MoveUp, window: &mut Window, cx: &mut Context<Menu>| {