๋ฐ์ํ
tab์ด null ๋ก ์ด๊ธฐํ ๋์ด์์ผ๋๊น, tab ์์ <v-data-table> ref์ ์ ๊ทผ์ด ์๋จ
tab: 'tab-1' ๋ก ๋ฐ๊พธ๊ณ ๋ค์ ์๋
<v-tabs-items v-model="tab">
<v-tab-item value="tab-1">
<v-data-table
:headers="headers"
:items="desserts"
item-key="name"
sort-by="name"
group-by="category"
class="elevation-1"
show-group-by
ref="table"
></v-data-table>
</v-tab-item>
</v-tabs-items>
<script>
var vm = new Vue({
el: '#app',
vuetify: new Vuetify(),
data () {
return {
tab: null,
headers: [
{
text: 'Dessert (100g serving)',
align: 'start',
value: 'name',
groupable: false,
},
{ text: 'Category', value: 'category', align: 'right' },
{ text: 'Dairy', value: 'dairy', align: 'right' },
],
desserts: [
{
name: 'Frozen Yogurt',
category: 'Ice cream',
dairy: 'Yes',
},
{
name: 'Ice cream sandwich',
category: 'Ice cream',
dairy: 'Yes',
},
{
name: 'Eclair',
category: 'Cookie',
dairy: 'Yes',
},
{
name: 'Cupcake',
category: 'Pastry',
dairy: 'Yes',
},
{
name: 'Gingerbread',
category: 'Cookie',
dairy: 'No',
},
],
}
},
mounted () {
let table = this.$refs.table;
console.log(this.$refs)
let keys = Object.keys(table.$vnode.componentInstance.openCache);
keys.forEach(x => {
table.$vnode.componentInstance.openCache[x] = false;
})
}
})
</script>โ
๋ฐ์ํ
'Web > Vue' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Vue.js] CLI ์ค์นํ๊ธฐ (0) | 2020.12.14 |
---|---|
[Vue.js] Vuetify, v-data-table (0) | 2020.12.02 |
[Vue] Vuetify Quick Start (0) | 2020.07.14 |
[Vue] Delimiters ๋ณ๊ฒฝ (0) | 2020.07.13 |
[Vue] ์์ํ๊ธฐ! (0) | 2020.07.13 |