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/new tabs #957

Merged
merged 4 commits into from
Oct 31, 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
16 changes: 16 additions & 0 deletions src/common/template/badge.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<template name="badge">
<t-badge
color="{{color}}"
content="{{content}}"
count="{{count || 0}}"
dot="{{dot}}"
max-count="{{maxCount || 99}}"
offset="{{offset}}"
shape="{{shape || 'circle'}}"
show-zero="{{showZero}}"
size="{{size || 'medium'}}"
t-class="{{tClass}}"
t-class-content="{{tClassContent}}"
t-class-count="{{tClassCount}}"
/>
</template>
8 changes: 5 additions & 3 deletions src/tabs/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@ show-bottom-line | Boolean | true | \- | N
sticky | Boolean | false | \- | N
sticky-props | Object | - | Typescript:`StickyProps`,[Sticky API Documents](./sticky?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
swipeable | Boolean | true | \- | N
value | String / Number | - | Typescript:`TabValue` `type TabValue = string | number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
default-value | String / Number | undefined | uncontrolled property。Typescript:`TabValue` `type TabValue = string | number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
theme | String | 'line' | options:line/tag/card | N
value | String / Number | - | Typescript:`TabValue` `type TabValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
default-value | String / Number | undefined | uncontrolled property。Typescript:`TabValue` `type TabValue = string \| number`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N

### Tabs Events

name | params | description
-- | -- | --
change | `(value: TabValue, label: string)` | \-
click | `(value: TabValue, label: string)` | \-
scroll | `({ scrollTop: number, isFixed: boolean })` | \-
scroll | `(scrollTop: number, isFixed: boolean)` | \-

### TabPanel Props

name | type | default | description | required
-- | -- | -- | -- | --
badge-props | Object | {} | \- | N
destroy-on-hide | Boolean | true | \- | N
disabled | Boolean | false | \- | N
label | String | - | \- | N
Expand Down
12 changes: 8 additions & 4 deletions src/tabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ CSS 变量名|说明
--td-tab-item-disabled-color | 选项卡禁止状态时字体颜色
--td-tab-track-color | 选项卡滑块颜色
--td-tab-track-thickness | 选项卡滑块厚度(水平时为高度,垂直时为宽度)
--td-tab-track-width | 选项卡滑块宽度
--td-tab-track-radius | 选项卡滑块圆角
--td-tab-border-color | 选项卡底部边框颜色

## 代码演示
Expand Down Expand Up @@ -119,21 +121,23 @@ show-bottom-line | Boolean | true | 是否展示底部激活线条 | N
sticky | Boolean | false | 是否开启粘性布局 | N
sticky-props | Object | - | 透传至 Sticky 组件。TS 类型:`StickyProps`,[Sticky API Documents](./sticky?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
swipeable | Boolean | true | 是否可以滑动切换 | N
value | String / Number | - | 激活的选项卡值。TS 类型:`TabValue` `type TabValue = string | number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
default-value | String / Number | undefined | 激活的选项卡值。非受控属性。TS 类型:`TabValue` `type TabValue = string | number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
theme | String | 'line' | 标签的样式。可选项:line/tag/card | N
value | String / Number | - | 激活的选项卡值。TS 类型:`TabValue` `type TabValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N
default-value | String / Number | undefined | 激活的选项卡值。非受控属性。TS 类型:`TabValue` `type TabValue = string \| number`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/tabs/type.ts) | N

### Tabs Events

名称 | 参数 | 描述
-- | -- | --
change | `(value: TabValue, label: string)` | 激活的选项卡发生变化时触发
click | `(value: TabValue, label: string)` | 点击 tab 选项卡时触发
scroll | `({ scrollTop: number, isFixed: boolean })` | 页面滚动时触发,scrollTop: 距离顶部位置,isFixed: 是否吸顶
click | `(value: TabValue, label: string)` | 点击选项卡时触发
scroll | `(scrollTop: number, isFixed: boolean)` | 页面滚动时触发

### TabPanel Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
badge-props | Object | null | 透传至 Badge 组件 | N
destroy-on-hide | Boolean | true | 选项卡内容隐藏时是否销毁 | N
disabled | Boolean | false | 是否禁用当前选项卡 | N
label | String | - | 选项卡名称 | N
Expand Down
Loading