-
Notifications
You must be signed in to change notification settings - Fork 3.7k
docs: translate custom-elements.md #1013
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
49413ce
docs: translate custom-elements.md
ikxin fb0d978
Apply suggestions from code review
ikxin 60df05f
Apply suggestions from code review
Justineo 8333e0d
Update custom-elements.md
ikxin 4bfa1c1
Update src/api/custom-elements.md
Justineo 8e5671a
Apply suggestions from code review
Justineo a1e4f41
Apply suggestions from code review
Justineo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,11 +1,10 @@ | ||||||
<!-- TODO: translation --> | ||||||
# Custom Elements API {#custom-elements-api} | ||||||
# 自定义元素 API {#custom-elements-api} | ||||||
|
||||||
## defineCustomElement() {#definecustomelement} | ||||||
|
||||||
This method accepts the same argument as [`defineComponent`](#definecomponent), but instead returns a native [Custom Element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) class constructor. | ||||||
此方法接受的参数与 [`defineComponent`](#definecomponent) 相同,但返回一个原生 [Custom Element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) 类构造函数。 | ||||||
|
||||||
- **Type** | ||||||
- **类型** | ||||||
|
||||||
```ts | ||||||
function defineCustomElement( | ||||||
|
@@ -20,28 +19,28 @@ This method accepts the same argument as [`defineComponent`](#definecomponent), | |||||
interface CustomElementsOptions { | ||||||
styles?: string[] | ||||||
|
||||||
// the following options are 3.5+ | ||||||
// 以下选项在 3.5+ 版本中支持 | ||||||
configureApp?: (app: App) => void | ||||||
shadowRoot?: boolean | ||||||
nonce?: string | ||||||
} | ||||||
``` | ||||||
ikxin marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
> Type is simplified for readability. | ||||||
> 类型为简化版,便于阅读。 | ||||||
|
||||||
- **Details** | ||||||
- **详情** | ||||||
|
||||||
In addition to normal component options, `defineCustomElement()` also supports a number of options that are custom-elements-specific: | ||||||
除了常规的组件选项,`defineCustomElement()` 还支持一系列特定于自定义元素的选项: | ||||||
|
||||||
- **`styles`**: an array of inlined CSS strings for providing CSS that should be injected into the element's shadow root. | ||||||
- **`styles`**: 一个内联 CSS 字符串数组,用于提供应注入元素阴影根的 CSS。 | ||||||
|
- **`styles`**: 一个内联 CSS 字符串数组,用于提供应注入元素阴影根的 CSS。 | |
- **`styles`**: 一个内联 CSS 字符串数组,用于提供应注入元素 shadow root 的 CSS。 |
Justineo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Justineo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Justineo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Justineo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Justineo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Justineo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.