Tabs support render head
This commit is contained in:
parent
eae3e936c8
commit
1f974700de
3 changed files with 43 additions and 4 deletions
|
@ -8,7 +8,8 @@
|
|||
<div :class="barClasses" :style="barStyle"></div>
|
||||
<div :class="tabCls(item)" v-for="(item, index) in navList" @click="handleChange(index)">
|
||||
<Icon v-if="item.icon !== ''" :type="item.icon"></Icon>
|
||||
{{ item.label }}
|
||||
<Render v-if="item.labelType === 'function'" :render="item.label"></Render>
|
||||
<template v-else>{{ item.label }}</template>
|
||||
<Icon v-if="showClose(item)" type="ios-close-empty" @click.native.stop="handleRemove(index)"></Icon>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -22,6 +23,7 @@
|
|||
</template>
|
||||
<script>
|
||||
import Icon from '../icon/icon.vue';
|
||||
import Render from '../base/render.vue';
|
||||
import { oneOf, getStyle } from '../../utils/assist';
|
||||
import Emitter from '../../mixins/emitter';
|
||||
|
||||
|
@ -30,7 +32,7 @@
|
|||
export default {
|
||||
name: 'Tabs',
|
||||
mixins: [ Emitter ],
|
||||
components: { Icon },
|
||||
components: { Icon, Render },
|
||||
props: {
|
||||
value: {
|
||||
type: [String, Number]
|
||||
|
@ -128,6 +130,7 @@
|
|||
this.navList = [];
|
||||
this.getTabs().forEach((pane, index) => {
|
||||
this.navList.push({
|
||||
labelType: typeof pane.label,
|
||||
label: pane.label,
|
||||
icon: pane.icon || '',
|
||||
name: pane.currentName || index,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue