Skip to content

Commit

Permalink
Feature/support lifecycle demo (#53)
Browse files Browse the repository at this point in the history
* feat(example): 支持omi组件格式

* feat(example): 支持omi组件格式

* feat(example): 支持omi组件格式
  • Loading branch information
duenyang authored Jun 19, 2024
1 parent b6f367c commit e377860
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 43 deletions.
2 changes: 1 addition & 1 deletion script/plugin-tdoc/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
.map(
(key) => `
let ${key}Component = null;
if('${key}'.endsWith('omi')){
if(${key}.toString().startsWith('class')){
define('t-${key.toLocaleLowerCase()}', ${key});
${key}Component = <t-${key.toLocaleLowerCase()} />;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spline: base

### 基础使用

{{ base-omi }}
{{ base }}

### 图标按钮

Expand Down
24 changes: 0 additions & 24 deletions src/button/_example/base-omi.tsx

This file was deleted.

38 changes: 21 additions & 17 deletions src/button/_example/base.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import 'tdesign-web-components/button';

export default function Button() {
return (
<div style={{ gap: 16, display: 'inline-flex' }}>
<t-button theme="default" variant="base">
填充按钮
</t-button>
<t-button theme="default" variant="outline">
描边按钮
</t-button>
<t-button theme="default" variant="dashed">
虚框按钮
</t-button>
<t-button theme="default" variant="text">
文字按钮
</t-button>
</div>
);
import { Component } from 'omi';

export default class Button extends Component {
render() {
return (
<div style={{ gap: 16, display: 'inline-flex' }}>
<t-button theme="default" variant="base">
填充按钮
</t-button>
<t-button theme="default" variant="outline">
描边按钮
</t-button>
<t-button theme="default" variant="dashed">
虚框按钮
</t-button>
<t-button theme="default" variant="text">
文字按钮
</t-button>
</div>
);
}
}

0 comments on commit e377860

Please sign in to comment.