【发布时间】:2020-01-10 01:06:50
【问题描述】:
我正在使用带有 VUE CLI 的 ag grid 社区版
在 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>
【问题讨论】:
标签: javascript vue.js ag-grid