From 49413ced8a3d8acf693bb9ed48d4df2b428662a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E7=BA=B8=E5=BF=98=E5=BF=A7?= Date: Wed, 11 Sep 2024 09:24:07 +0800 Subject: [PATCH 1/7] docs: translate custom-elements.md --- src/api/custom-elements.md | 39 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/api/custom-elements.md b/src/api/custom-elements.md index 4f0952f96..355c2e6b9 100644 --- a/src/api/custom-elements.md +++ b/src/api/custom-elements.md @@ -1,11 +1,10 @@ - -# 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( @@ -27,21 +26,21 @@ This method accepts the same argument as [`defineComponent`](#definecomponent), } ``` - > 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。 - - **`configureApp`** : a function that can be used to configure the Vue app instance for the custom element. + - **`configureApp`** : 一个函数,可用于配置自定义元素的 Vue 应用实例。 - - **`shadowRoot`** : `boolean`, defaults to `true`. Set to `false` to render the custom element without a shadow root. This means `