javascript - AG-Grid 在 IE11 中出现 vue 错误 挂载钩子中的错误:“TypeError:无法获取未定义或空引用的属性 'addEventListener'”
问题描述
我正在使用带有 VUE CLI 的 ag grid 社区版
Everytings 在 chrome、firefox 和 safari 上运行良好,但我在 IE 11 中遇到错误
错误说:
[Vue 警告]:挂载钩子中的错误:“TypeError:无法获取未定义或空引用的属性‘addEventListener’”
“无法获取未定义或空引用的属性‘addEventListener’”
这是我在 vue 中的代码
<template>
<div>
<button @click="getSelectedRows()">Get Selected Rows</button>
<ag-grid-vue style="width: 500px; height: 500px;"
class="ag-theme-balham"
:columnDefs="columnDefs"
:rowData="rowData">
</ag-grid-vue>
</div>
</template>
<style lang="scss" scoped>
</style>
<script>
import {AgGridVue} from 'ag-grid-vue'
export default {
components:{
AgGridVue
},
data(){
return{
columnDefs:null,
rowData:null,
gridApi: null,
columnApi: null,
autoGroupColumnDef: null,
}
},
methods : {
onGridReady : function(params){
this.gridApi = params.api;
this.columnApi = params.columnApi;
},
getSelectedRows : function(){
const selectedNodes = this.gridApi.getSelectedNodes();
const selectedData = selectedNodes.map(node => node.data);
const selectedDataStringPresentation = selectedData.map(node => node.make + ' ' + node.model).join(', ');
console.log(selectedDataStringPresentation);
}
},
beforeMount(){
this.columnDefs = [
{headerName: 'Make', field: 'make'},
{headerName: 'Model', field: 'model'},
{headerName: 'Price', field: 'price'}
];
this.rowData = [
{make: 'Toyota', model: 'Celica', price: 35000},
{make: 'Ford', model: 'Mondeo', price: 32000},
{make: 'Porsche', model: 'Boxter', price: 72000}
];
}
}
</script>
解决方案
它认为babel-polyfill
必须在 ag-grid 之前导入。
推荐阅读
- javascript - 如何在生产期间在电子反应应用程序中路由
- php - 如何根据国家/地区的IP重定向?
- excel - 用循环功能替换输入框
- python - 在 Pycharm、Python、Django 中使用函数名作为变量时出错:分配前引用了局部变量“已处理”
- c++ - 构建一个使用 boost 的 .cu 文件
- permissions - 在 graphene-django 中分离公共和私有 API 的推荐最佳实践是什么?
- pointers - 关于接口分配
- android - 阻塞时在Kotlin中调用String方法
- java - 获取数组中的一些项目
- android - 在 Android Q 中设置 MediaRecorder 的输出文件的推荐方法是什么?