mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-06-05 05:09:16 +08:00
feat(Tab): add info prop (#5274)
This commit is contained in:
parent
ebd69714a1
commit
d25ddc1914
@ -116,7 +116,7 @@ Vue.use(Grid).use(GridItem);
|
|||||||
| text | Text | *string* | - | - |
|
| text | Text | *string* | - | - |
|
||||||
| icon | Icon name or URL | *string* | - | - |
|
| icon | Icon name or URL | *string* | - | - |
|
||||||
| dot | Whether to show red dot | *boolean* | `false` | 2.2.1 |
|
| dot | Whether to show red dot | *boolean* | `false` | 2.2.1 |
|
||||||
| info | Content of the badge | *string \| number* | `''` | 2.2.1 |
|
| info | Content of the badge | *string \| number* | - | 2.2.1 |
|
||||||
| url | Link URL | *string* | - | - |
|
| url | Link URL | *string* | - | - |
|
||||||
| to | Target route of the link, same as to of vue-router | *string \| object* | - | - |
|
| to | Target route of the link, same as to of vue-router | *string \| object* | - | - |
|
||||||
| replace | If true, the navigation will not leave a history record | *boolean* | `false` | - |
|
| replace | If true, the navigation will not leave a history record | *boolean* | `false` | - |
|
||||||
|
@ -202,6 +202,8 @@ In swipeable mode, you can switch tabs with swipe gestrue in the content
|
|||||||
| title | Title | *string* | - | - |
|
| title | Title | *string* | - | - |
|
||||||
| title-style | Custom title style | *any* | - | 2.2.14 |
|
| title-style | Custom title style | *any* | - | 2.2.14 |
|
||||||
| disabled | Whether to disable tab | *boolean* | `false` | - |
|
| disabled | Whether to disable tab | *boolean* | `false` | - |
|
||||||
|
| dot | Whether to show red dot on the title | *boolean* | `false` | 2.3.0 |
|
||||||
|
| info | Content of the badge on the title | *string \| number* | - | 2.3.0 |
|
||||||
| url | Link | *string* | - | 2.2.1 |
|
| url | Link | *string* | - | 2.2.1 |
|
||||||
| to | Target route of the link, same as to of vue-router | *string \| object* | - | 2.2.1 |
|
| to | Target route of the link, same as to of vue-router | *string \| object* | - | 2.2.1 |
|
||||||
| replace | If true, the navigation will not leave a history record | *boolean* | `false` | 2.2.1 |
|
| replace | If true, the navigation will not leave a history record | *boolean* | `false` | 2.2.1 |
|
||||||
|
@ -207,6 +207,7 @@ export default {
|
|||||||
| title-style | 自定义标题样式 | *any* | - | 2.2.14 |
|
| title-style | 自定义标题样式 | *any* | - | 2.2.14 |
|
||||||
| disabled | 是否禁用标签 | *boolean* | `false` | - |
|
| disabled | 是否禁用标签 | *boolean* | `false` | - |
|
||||||
| dot | 是否在标题右上角显示小红点 | *boolean* | `false` | 2.3.0 |
|
| dot | 是否在标题右上角显示小红点 | *boolean* | `false` | 2.3.0 |
|
||||||
|
| info | 标题右上角徽标的内容 | *string \| number* | - | 2.3.0 |
|
||||||
| url | 点击后跳转的链接地址 | *string* | - | 2.2.1 |
|
| url | 点击后跳转的链接地址 | *string* | - | 2.2.1 |
|
||||||
| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | 2.2.1 |
|
| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - | 2.2.1 |
|
||||||
| replace | 是否在跳转时替换当前页面历史 | *boolean* | `false` | 2.2.1 |
|
| replace | 是否在跳转时替换当前页面历史 | *boolean* | `false` | 2.2.1 |
|
||||||
|
@ -10,6 +10,7 @@ export default createComponent({
|
|||||||
props: {
|
props: {
|
||||||
...routeProps,
|
...routeProps,
|
||||||
dot: Boolean,
|
dot: Boolean,
|
||||||
|
info: [Number, String],
|
||||||
name: [Number, String],
|
name: [Number, String],
|
||||||
title: String,
|
title: String,
|
||||||
titleStyle: null,
|
titleStyle: null,
|
||||||
|
@ -114,6 +114,20 @@ exports[`dot prop 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`info prop 1`] = `
|
||||||
|
<div class="van-tabs van-tabs--line">
|
||||||
|
<div class="van-tabs__wrap van-hairline--top-bottom">
|
||||||
|
<div role="tablist" class="van-tabs__nav van-tabs__nav--line">
|
||||||
|
<div role="tab" aria-selected="true" class="van-tab van-tab--active van-ellipsis"><span class="van-tab__text"><div class="van-info">10</div></span></div>
|
||||||
|
<div class="van-tabs__line"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="van-tabs__content">
|
||||||
|
<div role="tabpanel" class="van-tab__pane">Text</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`lazy render 1`] = `
|
exports[`lazy render 1`] = `
|
||||||
<div class="van-tabs van-tabs--line">
|
<div class="van-tabs van-tabs--line">
|
||||||
<div>
|
<div>
|
||||||
|
@ -251,3 +251,15 @@ test('dot prop', () => {
|
|||||||
|
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('info prop', () => {
|
||||||
|
const wrapper = mount({
|
||||||
|
template: `
|
||||||
|
<van-tabs>
|
||||||
|
<van-tab info="10">Text</van-tab>
|
||||||
|
</van-tabs>
|
||||||
|
`
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
@ -7,6 +7,7 @@ export default createComponent({
|
|||||||
props: {
|
props: {
|
||||||
dot: Boolean,
|
dot: Boolean,
|
||||||
type: String,
|
type: String,
|
||||||
|
info: [Number, String],
|
||||||
color: String,
|
color: String,
|
||||||
title: String,
|
title: String,
|
||||||
isActive: Boolean,
|
isActive: Boolean,
|
||||||
@ -76,7 +77,7 @@ export default createComponent({
|
|||||||
>
|
>
|
||||||
<span class={bem('text')}>
|
<span class={bem('text')}>
|
||||||
{this.slots() || this.title}
|
{this.slots() || this.title}
|
||||||
<Info dot={this.dot} />
|
<Info dot={this.dot} info={this.info} />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -268,8 +268,9 @@ export default createComponent({
|
|||||||
<Title
|
<Title
|
||||||
ref="titles"
|
ref="titles"
|
||||||
refInFor
|
refInFor
|
||||||
dot={item.dot}
|
|
||||||
type={type}
|
type={type}
|
||||||
|
dot={item.dot}
|
||||||
|
info={item.info}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
color={this.color}
|
color={this.color}
|
||||||
style={item.titleStyle}
|
style={item.titleStyle}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user