diff --git a/packages/uniapp-components/tab-bar/README.en-US.md b/packages/uniapp-components/tab-bar/README.en-US.md index 729a68a2e..e04ea3e9b 100644 --- a/packages/uniapp-components/tab-bar/README.en-US.md +++ b/packages/uniapp-components/tab-bar/README.en-US.md @@ -18,6 +18,12 @@ value | String / Number / Array | - | `v-model:value` is supported。Typescript: default-value | String / Number / Array | - | uncontrolled property。Typescript: `string \| number \| Array` | N z-index | Number | 1 | \- | N +### TabBar Events + +name | params | description +-- | -- | -- +change | `(context: { value: string \| number })` | \- + ### TabBar External Classes className | Description diff --git a/packages/uniapp-components/tab-bar/README.md b/packages/uniapp-components/tab-bar/README.md index cf6e77ac7..4694b1d13 100644 --- a/packages/uniapp-components/tab-bar/README.md +++ b/packages/uniapp-components/tab-bar/README.md @@ -66,6 +66,12 @@ value | String / Number / Array | - | 当前选中标签的索引。支持语法 default-value | String / Number / Array | - | 当前选中标签的索引。非受控属性。TS 类型:`string \| number \| Array` | N z-index | Number | 1 | 标签栏层级 | N +### TabBar Events + +名称 | 参数 | 描述 +-- | -- | -- +change | `(context: { value: string \| number })` | 选中标签切换时触发 + ### TabBar External Classes 类名 | 描述 @@ -87,7 +93,7 @@ value | String / Number | - | 标识符 | N 名称 | 描述 -- | -- -icon | 图标插槽,用于自定义图标区域内容 +icon | 自定义 `icon` 显示内容 ### CSS Variables diff --git a/packages/uniapp-components/tab-bar/props.ts b/packages/uniapp-components/tab-bar/props.ts index 892548ebb..aa9909bfc 100644 --- a/packages/uniapp-components/tab-bar/props.ts +++ b/packages/uniapp-components/tab-bar/props.ts @@ -59,4 +59,9 @@ export default { type: Number, default: 1, }, + /** 选中标签切换时触发 */ + onChange: { + type: Function, + default: () => ({}), + }, }; diff --git a/packages/uniapp-components/tab-bar/type.ts b/packages/uniapp-components/tab-bar/type.ts index 7be800d29..2d71fd7d1 100644 --- a/packages/uniapp-components/tab-bar/type.ts +++ b/packages/uniapp-components/tab-bar/type.ts @@ -53,4 +53,8 @@ export interface TdTabBarProps { * @default 1 */ zIndex?: number; + /** + * 选中标签切换时触发 + */ + onChange?: (context: { value: string | number }) => void; }