在vue的项目上通过npm安装了handsontable,但是运行的时候,总是会报
**TypeError: rootElement.insertBefore is not a function**
尝试过npm install @handsontable/vue 和 npm install handsontable
都一样会报这个错误,表格也出不来。。
请问有什么解决方法么?
代码如下:
<template>
<div>
<div id="test-hot-t" class="wrapper">
<htable :root="root" :settings="hotSettings"></htable>
</div>
</div>
</template>
<script>
import htable from 'handsontable';
export default {
name: 'HelloWorld',
el: "#test-hot-t",
data () {
return {
root: 'test-hot',
hotSettings: {
data: [
['20080101', 10, 11, 12, 13,true],
['20090101', 20, 11, 14, 13,true],
['20010101', 30, 15, 12, 13,true],
['20010101', 32, 213, 21, 312,true],
['20010201', 32, 213, 21, 312,true],
['20010301', 32, 213, 21, 312,true],
['20010401', 32, 213, 21, 312,true],
['20010501', 32, 213, 21, 312,true],
['20010601', 32, 213, 21, 312,true]
],
colHeaders: true
}
}
},
components:{
htable
}
}
</script>
改为<script>引入就可以了