0

我正在尝试从 Vue 指令订阅 Ag-Grid

function insert(el: HTMLElement, binding: DirectiveBinding, {componentInstance} : VNode){
    
    let grid = componentInstance as AgGridVue;

    grid.$on('rowDataChanged', (params) => {
      console.log(params) //Doesn't even enter to this event
    })

    grid.$on('row-data-changed', (params) => {
      console.log(params) //Neither here
    })
    
}

我只是想知道这是否可能。

4

1 回答 1

0

所以,我通过调试找到了大海捞针

let events = (componentInstance as any).gridOptions.api.eventService as EventService;

events.addEventListener('cellValueChanged', function (evt: CellValueChangedEvent) {
    // Logic
})
于 2021-01-12T13:35:28.740 回答