Created
March 25, 2020 14:36
-
-
Save vintprox/62ffc7b9ce663dc006ef7b30f075f472 to your computer and use it in GitHub Desktop.
Type inference for refs is weird here
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<v-data-table | |
:headers="fields" | |
:items="objects" | |
:sort-by="sortBy" | |
class="elevation-1" | |
> | |
</v-data-table> | |
</div> | |
</template> | |
<script lang="ts"> | |
import { defineComponent, reactive, toRefs } from '@vue/composition-api'; | |
export default defineComponent({ | |
setup() { | |
const state = reactive({ | |
fields: [ | |
{ value: 'id', text: 'ID', sortable: false, align: 'start' }, | |
{ value: 'type', text: 'Type' }, | |
{ value: 'name', text: 'Name' }, | |
{ value: 'revision', text: 'Revision' } | |
], | |
objects: [], | |
sortBy: ['revision', 'name', 'type'] | |
}); | |
return toRefs(state); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment