Is it possible to use ag-grid with vue without a builder?

后端 未结 2 1347
失恋的感觉
失恋的感觉 2020-12-22 02:45

In particular, can the typescript source of the ag-grid-vue component be compiled then included in a regular html file?

2条回答
  •  萌比男神i
    2020-12-22 03:02

    I found a way to do this without modifying the source. Near the top of ag-grid-vue.umd.js, you can see that the module does this:

    root["ag-grid-vue"] = factory(root["Vue"], root["agGrid"]);
    

    Here, "root" is the window, and the result of the factory call is what you'll want. But due to the dashes, you can't access it directly. But you can use the dictionary syntax (or whatever it's called):

    let agVueObj = window["ag-grid-vue"];
    //The component is a field on this object:
    let AgGridVue = agVueObj.AgGridVue;
    //Then register it as a component in your Vue instance:
    //components: { AgGridVue }
    

    And you should be able to use tags.

提交回复
热议问题