Skip to content

Commit b0912d6

Browse files
authored
docs(tab-bar): add change event (#4526)
1 parent 98f398c commit b0912d6

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

packages/uniapp-components/tab-bar/README.en-US.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ value | String / Number / Array | - | `v-model:value` is supported。Typescript:
1818
default-value | String / Number / Array | - | uncontrolled property。Typescript: `string \| number \| Array<string \| number>` | N
1919
z-index | Number | 1 | \- | N
2020

21+
### TabBar Events
22+
23+
name | params | description
24+
-- | -- | --
25+
change | `(context: { value: string \| number })` | \-
26+
2127
### TabBar External Classes
2228

2329
className | Description

packages/uniapp-components/tab-bar/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ value | String / Number / Array | - | 当前选中标签的索引。支持语法
6666
default-value | String / Number / Array | - | 当前选中标签的索引。非受控属性。TS 类型:`string \| number \| Array<string \| number>` | N
6767
z-index | Number | 1 | 标签栏层级 | N
6868

69+
### TabBar Events
70+
71+
名称 | 参数 | 描述
72+
-- | -- | --
73+
change | `(context: { value: string \| number })` | 选中标签切换时触发
74+
6975
### TabBar External Classes
7076

7177
类名 | 描述
@@ -87,7 +93,7 @@ value | String / Number | - | 标识符 | N
8793

8894
名称 | 描述
8995
-- | --
90-
icon | 图标插槽,用于自定义图标区域内容
96+
icon | 自定义 `icon` 显示内容
9197

9298
### CSS Variables
9399

packages/uniapp-components/tab-bar/props.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,9 @@ export default {
5959
type: Number,
6060
default: 1,
6161
},
62+
/** 选中标签切换时触发 */
63+
onChange: {
64+
type: Function,
65+
default: () => ({}),
66+
},
6267
};

packages/uniapp-components/tab-bar/type.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@ export interface TdTabBarProps {
5353
* @default 1
5454
*/
5555
zIndex?: number;
56+
/**
57+
* 选中标签切换时触发
58+
*/
59+
onChange?: (context: { value: string | number }) => void;
5660
}

0 commit comments

Comments
 (0)