是否可以在没有构建器的情况下将 ag

编程入门 行业动态 更新时间:2024-10-18 05:41:19
本文介绍了是否可以在没有构建器的情况下将 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屋!

更多推荐

[db:关键词]

本文发布于:2023-03-31 10:13:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/801863.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:情况下   ag

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!