[英]AG-Grid with vue error in IE11 Error in mounted hook: “TypeError: Unable to get property 'addEventListener' of undefined or null reference”
I am using the ag grid community edition with VUE CLI 我正在VUE CLI中使用ag网格社区版
Everytings working fine on chrome,firefox and safari but I am encountering an error in IE 11 chrome,firefox和safari上的所有功能都可以正常工作,但是我在IE 11中遇到错误
The error says: 错误提示:
[Vue warn]: Error in mounted hook: "TypeError: Unable to get property 'addEventListener' of undefined or null reference" [Vue警告]:挂接的钩子中出现错误:“ TypeError:无法获取未定义或空引用的属性'addEventListener'”
"Unable to get property 'addEventListener' of undefined or null reference" “无法获取未定义或空引用的属性'addEventListener'”
Here is my code in vue 这是我在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
polyfill。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.