2018-03-09 05:26:34 +00:00
|
|
|
<cn>
|
|
|
|
#### 带页签的卡片
|
|
|
|
可承载更多内容
|
|
|
|
</cn>
|
|
|
|
|
|
|
|
<us>
|
|
|
|
#### With tabs
|
|
|
|
More content can be hosted
|
|
|
|
</us>
|
|
|
|
|
2019-10-09 10:32:23 +00:00
|
|
|
```tpl
|
2018-03-09 05:26:34 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
2018-04-06 12:56:19 +00:00
|
|
|
<a-card
|
2018-03-09 05:26:34 +00:00
|
|
|
style="width:100%"
|
|
|
|
title="Card title"
|
|
|
|
:tabList="tabList"
|
2018-09-05 13:28:54 +00:00
|
|
|
:activeTabKey="key"
|
2018-03-09 05:26:34 +00:00
|
|
|
@tabChange="key => onTabChange(key, 'key')"
|
|
|
|
>
|
2019-09-28 12:45:07 +00:00
|
|
|
<span slot="customRender" slot-scope="item"> <a-icon type="home" />{{item.key}} </span>
|
2018-03-09 05:26:34 +00:00
|
|
|
<a href="#" slot="extra">More</a>
|
|
|
|
{{contentList[key]}}
|
2018-04-06 12:56:19 +00:00
|
|
|
</a-card>
|
2018-03-09 05:26:34 +00:00
|
|
|
<br /><br />
|
2018-04-06 12:56:19 +00:00
|
|
|
<a-card
|
2018-03-09 05:26:34 +00:00
|
|
|
style="width:100%"
|
|
|
|
:tabList="tabListNoTitle"
|
2018-04-06 12:56:19 +00:00
|
|
|
:activeTabKey="noTitleKey"
|
2018-03-09 05:26:34 +00:00
|
|
|
@tabChange="key => onTabChange(key, 'noTitleKey')"
|
|
|
|
>
|
2018-04-06 12:56:19 +00:00
|
|
|
<p v-if="noTitleKey === 'article'">article content</p>
|
|
|
|
<p v-else="noTitleKey === 'app'">app content</p>
|
|
|
|
<p v-else="noTitleKey === 'project'">project content</p>
|
|
|
|
</a-card>
|
2018-03-09 05:26:34 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-09-28 12:45:07 +00:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
tabList: [
|
|
|
|
{
|
|
|
|
key: 'tab1',
|
|
|
|
// tab: 'tab1',
|
|
|
|
scopedSlots: { tab: 'customRender' },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'tab2',
|
|
|
|
tab: 'tab2',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
contentList: {
|
|
|
|
tab1: 'content1',
|
|
|
|
tab2: 'content2',
|
|
|
|
},
|
|
|
|
tabListNoTitle: [
|
|
|
|
{
|
|
|
|
key: 'article',
|
|
|
|
tab: 'article',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'app',
|
|
|
|
tab: 'app',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'project',
|
|
|
|
tab: 'project',
|
|
|
|
},
|
|
|
|
],
|
2018-03-09 05:26:34 +00:00
|
|
|
key: 'tab1',
|
2019-09-28 12:45:07 +00:00
|
|
|
noTitleKey: 'app',
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onTabChange(key, type) {
|
|
|
|
console.log(key, type);
|
|
|
|
this[type] = key;
|
2018-03-09 05:26:34 +00:00
|
|
|
},
|
|
|
|
},
|
2019-09-28 12:45:07 +00:00
|
|
|
};
|
2018-03-09 05:26:34 +00:00
|
|
|
</script>
|
|
|
|
```
|