是否可以在没有构建器的情况下将 ag-grid 与 vue 一起使用? [英] Is it possible to use ag-grid with vue without a builder?

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

问题描述

特别是,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 }

而且你应该能够使用 标签.

And you should be able to use <ag-grid-vue> tags.

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

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