This page covers a non-latest version of Handsontable.
# Referencing the Handsontable instance in Vue 3
# Overview
The following example implements the @handsontable/vue3
, showing how to reference the Handsontable instance from the wrapper component.
Find out which Vue 3 versions are supported
# Example
import { createApp } from 'vue';
import { HotTable } from '@handsontable/vue3';
import { registerAllModules } from 'handsontable/registry';
import { createSpreadsheetData } from './helpers';
// register Handsontable's modules
registerAllModules();
const app = createApp({
data() {
return {
hotSettings: {
data: createSpreadsheetData(4, 4),
colHeaders: true,
height: 'auto',
licenseKey: 'non-commercial-and-evaluation'
}
};
},
methods: {
swapHotData: function() {
// The Handsontable instance is stored under the `hotInstance` property of the wrapper component.
this.$refs.hotTableComponent.hotInstance.loadData([['new', 'data']]);
}
},
components: {
HotTable,
}
});
app.mount('#example1');