vue3-datatable
vue3-datatable copied to clipboard
Cannot load into non-typescript Vue 3 project
I am getting this error:
Vue warn]: Invalid vnode type when creating vnode: undefined.
at <ClassList>
at <ClassView onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
at <RouterView>
at <App>
when trying to import the component in a Vue 3 non-typescript project. Is typescript required for the component to work?
<template>
<div>Class list</div>
<data-table :rows="data"/>
</template>
<script setup>
import "@jobinsjp/vue3-datatable/dist/style.css"
import DataTable from "@jobinsjp/vue3-datatable";
import {ref} from "vue";
const data = ref([
{
"id": 1,
...
Jeez, this makes it work:
import {DataTable} from "@jobinsjp/vue3-datatable";
As mentioned in other issues some minimal documentation would really really help!
First, add @jobinsjp/vue3-datatable
dependencies.
yarn add @jobinsjp/vue3-datatable
and use it as:
<template>
<DataTable :rows="data"></DataTable>
</template>
<script setup>
import { DataTable } from "@jobinsjp/vue3-datatable"
import "@jobinsjp/vue3-datatable/dist/style.css"
const data = [
{
"id": 1,
"first_name": "Misti",
"last_name": "Strase",
"email": "[email protected]",
"gender": "Non-binary",
"ip_address": "151.38.32.165",
},
{
"id": 2,
"first_name": "Valentina",
"last_name": "Bonas",
"email": "[email protected]",
"gender": "Agender",
"ip_address": "103.10.225.246",
},
]
</script>
Complete example here: https://stackblitz.com/edit/vitejs-vite-t1tnku?file=src/App.vue
We will be closing this issue as resolved, but if you encounter any further problems related to this issue in the future, please feel free to reopen it.