vue3-datatable icon indicating copy to clipboard operation
vue3-datatable copied to clipboard

Cannot load into non-typescript Vue 3 project

Open franck102 opened this issue 2 years ago • 1 comments

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,
...

franck102 avatar Jun 22 '22 10:06 franck102

Jeez, this makes it work:

import {DataTable} from "@jobinsjp/vue3-datatable";

As mentioned in other issues some minimal documentation would really really help!

franck102 avatar Jun 22 '22 10:06 franck102

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

bedus-creation avatar Jan 19 '23 10:01 bedus-creation

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.

bedus-creation avatar Mar 02 '23 19:03 bedus-creation