[英]AG-Grid with vue error in IE11 Error in mounted hook: “TypeError: Unable to get property 'addEventListener' of undefined or null reference”
我正在VUE CLI中使用ag網格社區版
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
polyfill。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.