naive-ui/demo/documentation/components/tabs/enUS/card.md

47 lines
907 B
Markdown
Raw Normal View History

2019-10-22 16:56:50 +08:00
# Card
```html
<n-tabs
v-model="name"
type="card"
closable
@close="handleClose"
2019-12-13 17:32:38 +08:00
@scrollable-change="handleScrollableChange"
:nav-style="{
borderTop: 'none',
margin: '0 -24px',
padding: `4px ${tabNavScrollable ? 0 : 24}px`
}"
2019-10-22 16:56:50 +08:00
>
<n-tab-panel
v-for="panel in panels"
:key="panel"
:label="panel.toString()"
:name="panel.toString()"
>
{{ panel }}
</n-tab-panel>
</n-tabs>
```
```js
export default {
data () {
return {
panels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
2019-12-13 17:32:38 +08:00
name: '1',
tabNavScrollable: false
2019-10-22 16:56:50 +08:00
}
},
methods: {
2019-12-13 17:32:38 +08:00
handleScrollableChange (value) {
this.tabNavScrollable = value
},
2019-10-22 16:56:50 +08:00
handleClose (name) {
this.$NMessage.info('Close ' + name)
const index = this.panels.findIndex(v => name === v.toString())
if (~index) {
this.panels.splice(index, 1)
}
}
}
}
```