【发布时间】:2020-02-15 02:30:16
【问题描述】:
是否有人在最新的 Vuetify 版本中使用 v-slot 实现了分组行?他们的示例如下所示:
<template>
<v-data-table
:headers="headers"
:items="desserts"
item-key="name"
group-by="category"
class="elevation-1"
show-group-by
></v-data-table>
</template>
<script>
export default {
data () {
return {
headers: [
{
text: 'Dessert (100g serving)',
align: 'left',
value: 'name',
},
{ text: 'Category', value: 'category' },
],
desserts: [
{
name: 'Frozen Yogurt',
category: 'Ice cream',
},
{
name: 'Ice cream sandwich',
category: 'Ice cream',
},
{
name: 'Eclair',
category: 'Cookie',
},
{
name: 'Cupcake',
category: 'Pastry',
},
{
name: 'Gingerbread',
category: 'Cookie',
},
{
name: 'Jelly bean',
category: 'Candy',
},
{
name: 'Lollipop',
category: 'Candy',
},
{
name: 'Honeycomb',
category: 'Toffee',
},
{
name: 'Donut',
category: 'Pastry',
},
{
name: 'KitKat',
category: 'Candy',
},
],
}
},
}
</script>
这可行,但我想推出自己的风格。我尝试过这样的事情:
<template v-slot:group="data">
{{data}}
</template>
我看到了对象,但缺少样式。据我所知,文档中缺少它。
如果有人已经实现了类似的东西,我们将不胜感激。
【问题讨论】:
标签: javascript vue.js vuejs2 vuetify.js