Skip to content

Commit

Permalink
feat: 完善 switch 组件相关文档 & 类型描述优化 (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiner-tang committed Nov 29, 2022
1 parent ed2c5fa commit f0e0853
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .changeset/wicked-balloons-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"ossaui": patch
"ossa-demo": patch
"ossa-doc": patch
---

feat: 完善 switch 组件相关文档 & 类型描述优化
6 changes: 3 additions & 3 deletions packages/ossa-demo/src/components/switch/demo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ const initialListApi = {
list: ["checked", "是否打开", "boolean", "false"],
},
{
list: ["onColor", "打开时的背景色,可选", "string", "-"],
list: ["onColor", "打开时的背景色,可选", "string", "#44DB5E"],
},
{
list: ["offColor", "关闭时的背景色,可选", "string", "-"],
list: ["offColor", "关闭时的背景色,可选", "string", "#FFFFFF"],
},
{
list: ["nodeColor", "滑块颜色,可选", "string", "-"],
list: ["nodeColor", "滑块颜色,可选", "string", "#FFFFFF"],
},
{
list: ["isDisabled", "禁用,可选,`isDisabled`属性在未来版本中将被删除,请使用`disabled`代替", "boolean", "false"],
Expand Down
6 changes: 3 additions & 3 deletions packages/ossa-doc/docs/组件/switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ demo_url: 'https://neteaseyanxuan.github.io/OSSA/#/components/switch/demo/index'
|------|------|------|------|
|isChecked|是否打开,`isChecked`属性在未来版本中将被删除,请使用`checked`代替|boolean|false|
|checked|是否打开|boolean|false|
|onColor|打开时的背景色,可选|string|-|
|offColor|关闭时的背景色,可选|string|-|
|nodeColor|滑块颜色,可选|string|-|
|onColor|打开时的背景色,可选|string|#44DB5E|
|offColor|关闭时的背景色,可选|string|#FFFFFF|
|nodeColor|滑块颜色,可选|string|#FFFFFF|
|isDisabled|禁用,可选,`isDisabled`属性在未来版本中将被删除,请使用`disabled`代替|boolean|false|
|disabled|禁用,可选|boolean|false|

Expand Down
18 changes: 17 additions & 1 deletion packages/ossa/types/switch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,20 @@ interface SwitchProps extends OsComponent {
* 是否选中
*/
checked?: boolean;
/**
* 打开时的背景色
* @default '#44DB5E'
*/
onColor?: string;
/**
* 关闭时的背景色
* @default '#FFF'
*/
offColor?: string;
/**
* 滑块颜色
* @default '#FFF'
*/
nodeColor?: string;
/**
* 是否禁用
Expand All @@ -25,7 +37,11 @@ interface SwitchProps extends OsComponent {
* @default false
*/
disabled?: boolean;
onChange: (v) => void;
/**
* 状态改变时触发
* @param v 当前开关的开启状态
*/
onChange: (v: boolean) => void;
}

declare const Switch: ComponentClass<SwitchProps>;
Expand Down

0 comments on commit f0e0853

Please sign in to comment.