ant-design-vue/components/card/demo/tabsCard.md

76 lines
1.4 KiB
Markdown
Raw Normal View History

2018-03-09 05:26:34 +00:00
<cn>
#### 带页签的卡片
可承载更多内容
</cn>
<us>
#### With tabs
More content can be hosted
</us>
```html
<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"
@tabChange="key => onTabChange(key, 'key')"
>
<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>
export default {
data () {
return {
tabList: [{
key: 'tab1',
tab: 'tab1',
}, {
key: 'tab2',
tab: 'tab2',
}],
contentList: {
tab1: 'content1',
tab2: 'content2',
},
tabListNoTitle: [{
key: 'article',
tab: 'article',
}, {
key: 'app',
tab: 'app',
}, {
key: 'project',
tab: 'project',
}],
key: 'tab1',
2018-04-06 12:56:19 +00:00
noTitleKey: 'app',
2018-03-09 05:26:34 +00:00
}
},
methods: {
onTabChange (key, type) {
console.log(key, type)
this[type] = key
},
},
}
</script>
```