Referencing the Handsontable instance
优质
小牛编辑
124浏览
2023-12-01
An implementation of the @handsontable/vue
explaining how to reference the Handsontable instance from the wrapper component.
import Vue from 'vue'; import { HotTable } from '@handsontable/vue'; import Handsontable from 'handsontable'; new Vue({ el: '#example1', data: function() { return { hotSettings: { data: Handsontable.helper.createSpreadsheetData(4, 4), colHeaders: true } } }, 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 } });