特别是 ag-grid-vue 组件的 typescript 源是否可以编译然后包含在常规 html 文件中?
最佳答案
我找到了一种无需修改源代码即可执行此操作的方法。在 ag-grid-vue.umd.js 的顶部附近,您可以看到该模块执行以下操作:
root["ag-grid-vue"] = factory(root["Vue"], root["agGrid"]);
在这里,“root”是窗口,工厂调用的结果就是您想要的。但是由于破折号,您无法直接访问它。但您可以使用字典语法(或任何名称):
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 }
你应该可以使用 <ag-grid-vue>
标签。
关于vuejs2 - 是否可以在没有构建器的情况下将 ag-grid 与 vue 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56334844/