在没有构建器的情况下,可以在vue中使用ag-grid吗? [英] Is it possible to use ag-grid with vue without a builder?

查看:146
本文介绍了在没有构建器的情况下,可以在vue中使用ag-grid吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尤其是,可以编译ag-grid-vue组件的打字稿源,然后将其包含在常规html文件中吗?

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

推荐答案

我找到了一种无需修改源代码的方法。在ag-grid-vue.umd.js顶部附近,您可以看到该模块执行了以下操作:

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"]);

在这里, root是窗口,工厂调用的结果就是想。但是由于破折号,您无法直接访问它。但是您可以使用字典语法(或任何它所说的语法):

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 }

您应该能够使用< ag-grid-vue> 标签。

这篇关于在没有构建器的情况下,可以在vue中使用ag-grid吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆