mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
* 0.20 Changelog * Improve changelog generator * Add blog post * Add blog post * Apply suggestions from code review Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com> Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com> * update Changelog * update Cargo.toml * changelog gen compiles * website version 0.20 * add migration guides * prettier * i18n Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com> Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>
15 lines
628 B
Plaintext
15 lines
628 B
Plaintext
---
|
||
description: 用來產生 HTML 與 SVG 的巨集
|
||
slug: /concepts/html
|
||
---
|
||
|
||
# 使用 html!
|
||
|
||
`html!` 巨集可以讓你用 HTML 與 SVG 寫元件。如果你寫過 React 的 JSX(一種 JavaScript 的擴展,可以讓你在 JavaScript 中寫 HTML),應該會覺得這兩者十分相似。
|
||
|
||
**重要提示**
|
||
|
||
1. 在 `html!` 裡,只能有一個根結點(但你可以用 [Fragment 或是 Iterators](https://yew.rs/concepts/html/lists) 來繞過這個限制。)
|
||
2. 空的 `html! {}` 是合法的,且他不會渲染任何東西在畫面上
|
||
3. 字串必須被雙引號與大括號包裹住:`html! { "Hello, World" }`
|