Skip to content

Instantly share code, notes, and snippets.

@vintprox
Created March 25, 2020 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vintprox/62ffc7b9ce663dc006ef7b30f075f472 to your computer and use it in GitHub Desktop.
Save vintprox/62ffc7b9ce663dc006ef7b30f075f472 to your computer and use it in GitHub Desktop.
Type inference for refs is weird here
<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