diff --git a/examples/docs/en-US/tabs.md b/examples/docs/en-US/tabs.md
index 9a9b23d48..49d8e8a2b 100644
--- a/examples/docs/en-US/tabs.md
+++ b/examples/docs/en-US/tabs.md
@@ -22,9 +22,6 @@
},
handleClick(tab, event) {
console.log(tab, event);
- },
- renderTab(h, tab) {
- return {tab.label};
}
}
}
@@ -148,25 +145,19 @@ Border card tabs.
### Custom Tab
-You can use `label-content` property to customize the tab
+You can use named slot to customize the tab label content.
-:::demo `label-content` is a render function,which return the vnode of the tab.
+:::demo
```html
- Route
+
+ Route
+ Route
+
Config
Role
Task
-
```
:::
@@ -188,7 +179,6 @@ You can use `label-content` property to customize the tab
| Attribute | Description | Type | Accepted Values | Default |
|---------- |-------- |---------- |------------- |-------- |
| label | title of the tab | string | — | — |
-| label-content | render function for tab title | Function(h, tab:vueInstance) | - | - |
| disabled | whether Tab is disabled | boolean | - | false |
| name | identifier corresponding to the activeName of Tabs, representing the alias of the tab-pane | string | — | ordinal number of the tab-pane in the sequence, i.e. the first tab-pane is '1' |
| closable | whether Tab is closable | boolean | — | false |
diff --git a/examples/docs/zh-CN/tabs.md b/examples/docs/zh-CN/tabs.md
index 2040bee3f..58d8d6481 100644
--- a/examples/docs/zh-CN/tabs.md
+++ b/examples/docs/zh-CN/tabs.md
@@ -22,9 +22,6 @@
},
handleClick(tab, event) {
console.log(tab, event);
- },
- renderTab(h, tab) {
- return {tab.label};
}
}
}
@@ -145,25 +142,19 @@
### 自定义标签页
-可以通过 `label-content` 属性来实现自定义标签页的内容
+可以通过具名 `slot` 来实现自定义标签页的内容
-:::demo `label-content` 是一个 render function,在这个方法里返回的 vnode 会被渲染到标签页中。
+:::demo
```html
- 我的行程
+
+ 我的行程
+ 我的行程
+
消息中心
角色管理
定时任务补偿
-
```
:::
@@ -200,7 +191,6 @@
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---------- |-------- |---------- |------------- |-------- |
| label | 选项卡标题 | string | — | — |
-| label-content | 选项卡的标题的渲染 Function | Function(h, tab:vueInstance) | - | - |
| disabled | 是否禁用 | boolean | - | false |
| name | 与选项卡 activeName 对应的标识符,表示选项卡别名 | string | — | 该选项卡在选项卡列表中的顺序值,如第一个选项卡则为'1' |
| closable | 标签是否可关闭 | boolean | — | false |
diff --git a/packages/tabs/src/tabs.vue b/packages/tabs/src/tabs.vue
index d2a2dec78..c64878fc3 100644
--- a/packages/tabs/src/tabs.vue
+++ b/packages/tabs/src/tabs.vue
@@ -112,9 +112,7 @@
? { handleTabRemove(tab, ev); }}>
: null;
- const tabLabelContent = tab.labelContent
- ? tab.labelContent.call(this._renderProxy, h, tab)
- : tab.label;
+ const tabLabelContent = tab.$slots.label || tab.label;
return (
{
});
});
});
- it('tab title render function', done => {
- vm = createVue({
- template: `
-
- A
- B
- C
- D
-
- `,
- methods: {
- renderTitle(h) {
- return 用户管理;
- }
- }
- }, true);
- vm.$nextTick(_ => {
- expect(vm.$el.querySelector('.el-tabs__item span').innerText).to.equal('用户管理');
- done();
- });
- });
it('disabled', done => {
vm = createVue({
template: `