Im trying to install handsontable on my project I use
npm install handsontable @handsontable/vue
Maybe I need to create a plugin? How Can I use handsontable in a existign nuxt project?
ok, I got success by this. Hope this helps you and save some time.
npm install handsontable @handsontable/vue
const HotTable = !process.client ? null : require('@handsontable/vue').HotTable
export default HotTable
build: {
vendor: ['handsontable'],
},
plugins: [
{ src: '~/plugins/vue-handsontable', ssr: false },
]
<template>
<HotTable :settings="settings" :data="data"></HotTable>
</template>
<script>
import HotTable from '~/plugins/vue-handsontable'
export default {
data: function() {
return {
settings: {
data: [
["", "Ford", "Volvo", "Toyota", "Honda"],
["2016", 10, 11, 12, 13],
["2017", 20, 11, 14, 13],
["2018", 30, 15, 12, 13]
],
colHeaders: true,
rowHeaders: true,
}
};
},
head: {
link: [
{ rel: 'stylesheet', type: 'text/css',
href: '/your/path/to/css/directory/handsontable.full.min.css' },
]
},
components: {
HotTable
}
}
</script>
Wish you best of luck.
REV 1:
The license key is obligatory since Handsontable 7.0.0 (released in March 2019).
settings: {
data: [
["", "Ford", "Volvo", "Toyota", "Honda"],
["2016", 10, 11, 12, 13],
["2017", 20, 11, 14, 13],
["2018", 30, 15, 12, 13]
],
rowHeaders: true,
colHeaders: true,
licenseKey: 'non-commercial-and-evaluation'
}