Skip to content
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

feat(switch): 完善 switch 组件相关文档 & 类型描述优化 #93

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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