You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/omi/README.md
+22-22Lines changed: 22 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -245,16 +245,16 @@ define('my-app', class extends withTwind(Component) {
245
245
})
246
246
``` -->
247
247
248
-
## ExportParts - 样式化嵌套组件
248
+
## ExportParts - Styling Nested Components
249
249
250
-
Omi 支持 Web Components 的 `exportparts`属性,允许将嵌套组件的 CSS parts 暴露给外部进行样式化。这使得在保持样式封装的同时,实现强大的组件组合。
250
+
Omi supports the Web Components `exportparts`attribute, allowing nested component CSS parts to be exposed for external styling. This enables powerful component composition while maintaining style encapsulation.
251
251
252
-
### 基本用法
252
+
### Basic Usage
253
253
254
254
```tsx
255
255
import { render, tag, Component, h } from'omi'
256
256
257
-
//内部组件定义 CSS parts
257
+
//Inner component defines CSS parts
258
258
@tag('inner-button')
259
259
classInnerButtonextendsComponent {
260
260
static css =`
@@ -278,7 +278,7 @@ class InnerButton extends Component {
278
278
}
279
279
}
280
280
281
-
//容器组件使用 exportparts
281
+
//Container component uses exportparts
282
282
@tag('card-component')
283
283
classCardComponentextendsComponent {
284
284
static css =`
@@ -288,7 +288,7 @@ class CardComponent extends Component {
288
288
border-radius: 8px;
289
289
}
290
290
291
-
/* 通过 ::part() 样式化嵌套组件 */
291
+
/* Style nested components via ::part() */
292
292
inner-button::part(button) {
293
293
background: #28a745;
294
294
border-color: #28a745;
@@ -298,7 +298,7 @@ class CardComponent extends Component {
298
298
render() {
299
299
return (
300
300
<divclass="card"part="card">
301
-
{/*导出嵌套组件的 parts */}
301
+
{/*Export nested component parts */}
302
302
<inner-buttonexportparts="button, icon, text">
303
303
Click me
304
304
</inner-button>
@@ -307,11 +307,11 @@ class CardComponent extends Component {
0 commit comments