ant-design-vue/components/tabs/demo/icon.vue

44 lines
843 B
Vue
Raw Normal View History

2017-12-01 04:21:43 +00:00
<template>
2017-12-08 03:46:53 +00:00
<div>
2017-12-01 04:21:43 +00:00
<Tabs defaultActiveKey="2">
2017-12-08 03:46:53 +00:00
<TabPane :tab="(h, tabKey) => renderTab(h, tabKey, 'apple')" key="1">
2017-12-01 04:21:43 +00:00
Tab 1
</TabPane>
2017-12-08 03:46:53 +00:00
<TabPane :tab="(h, tabKey) => renderTab(h, tabKey, 'android')" key="2">
2017-12-01 04:21:43 +00:00
Tab 2
</TabPane>
</Tabs>
2017-12-08 03:46:53 +00:00
<Tabs defaultActiveKey="2">
<span slot="tab_1">
<Icon type="apple" />
Tab 1
</span>
<TabPane key="1">
Tab 1
</TabPane>
<span slot="tab_2">
<Icon type="android" />
Tab 2
</span>
<TabPane key="2">
Tab 2
</TabPane>
</Tabs>
</div>
2017-12-01 04:21:43 +00:00
</template>
<script>
import { Tabs, Icon } from 'antd'
export default {
methods: {
renderTab (h, tabKey, iconType) {
return h('span', [<Icon type={iconType} />, `Tab ${tabKey}`])
},
},
components: {
Tabs,
TabPane: Tabs.TabPane,
Icon,
},
}
</script>