mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
GitBook: [zh_tw] 2 pages modified
This commit is contained in:
parent
df1a4342f9
commit
0a87ab854c
@ -1,16 +1,16 @@
|
||||
---
|
||||
description: The procedural macro for generating HTML and SVG
|
||||
description: 用來產生 HTML 與 SVG 的巨集
|
||||
---
|
||||
|
||||
# 使用 html!
|
||||
|
||||
The `html!` macro allows you to write declarative HTML and SVG for your components. If you've used React's JSX it will feel quite familiar.
|
||||
`html!` 巨集可以讓你用 HTML 與 SVG 寫元件。如果你寫過 React 的 JSX,應該會覺得這兩者十分相似。
|
||||
|
||||
**Important notes**
|
||||
**重要提示**
|
||||
|
||||
1. There must be only one root node in an `html!` invocation
|
||||
2. An empty `html! {}` invocation is valid and will not render anything
|
||||
3. Literals must always be quoted and wrapped in braces: `html! { "Hello, World" }`
|
||||
1. 在 `html!` 裡,只能有一個根結點
|
||||
2. 空的 `html! {}` 是合法的,且他不會渲染任何東西在畫面上
|
||||
3. 字串必須被雙引號與大括號包裹住:`html! { "Hello, World" }`
|
||||
|
||||
{% page-ref page="lists.md" %}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
## Fragments
|
||||
|
||||
The `html!` macro always requires a single root node. In order to get around this restriction, it's valid to wrap content in empty tags:
|
||||
`html!` 巨集裡必須只有一個根結點。為了可以繞過這個限制,將兩個以上的結點,用空的標籤包裹起來,是合法的:
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Valid" %}
|
||||
@ -30,7 +30,7 @@ html! {
|
||||
|
||||
## Iterators
|
||||
|
||||
Yew supports two different syntaxes for building html from an iterator:
|
||||
Yew 支援兩種不同的方式,從 iterator 建構 html:
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Syntax Type 1" %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user