Nuxt Intallation [@jiahengaa - you can extend your README by this description]
Closed this issue · 2 comments
gustawdaniel commented
- Install
npm i beegridtable
- Create plugin
plugins/bee-grid-table.ts
with content:
import Vue from "vue";
import BeeGridTable from "beegridtable";
import 'beegridtable/dist/styles/beegridtable.css';
//@ts-ignore
import BeeLocale from "beegridtable/src/locale"
Vue.use(BeeGridTable, {
locale: BeeLocale,
capture: true,
});
- In
nuxt.config.js
register plugin:
plugins: [
{src: '~/plugins/bee-grid-table', ssr: false}
],
You can't omit {ssr:false}
option and use
plugins: [
'~/plugins/bee-grid-table'
],
because of you will see error:
Cannot use import statement outside a module
- In your component use it:
<template>
<div>
<client-only placeholder="Loading...">
<BeeGridTable :columns="columns" :data="rows"/>
</client-only>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
name: 'index',
computed: {
columns() {
return [
{
title: "Name",
key: "name",
align: "center",
}
]
},
rows() {
return [{name: 'A'}, {name: 'B'}]
}
}
})
</script>
jiahengaa commented
Thank you very much for your advice
jiahengaa commented
http://beegridtable.com/install
Has been updated to the installation document, thank you for your help !