gpt4 book ai didi

javascript - 未捕获的 ReferenceError : ACDesigner is not defined

转载 作者:行者123 更新时间:2023-12-04 14:54:12 25 4
gpt4 key购买 nike

我正在尝试使用 Adaptive Card Designer 构建一个 HTML 页面。
我正在按照说明,使用本文档中的 CDN 方法:
https://www.npmjs.com/package/adaptivecards-designer
任何输入表示赞赏。非常感谢! :)
它抛出以下错误:

Uncaught ReferenceError: ACDesigner is not defined
我的 HTML 文件如下:
<html>

<head>
</head>
<script src="https://unpkg.com/adaptivecards@latest/dist/adaptivecards.min.js"></script>
<script src="https://unpkg.com/adaptive-expressions@4/lib/browser.js"></script>
<script src="https://unpkg.com/adaptivecards-templating@latest/dist/adaptivecards-templating.min.js"></script>
<script src="https://unpkg.com/markdown-it@8.4.0/dist/markdown-it.min.js"></script>
<script src="https://unpkg.com/monaco-editor@0.17.1/min/vs/loader.js"></script>
<!-- <script src="https://unpkg.com/adaptivecards-designer@latest/dist/adaptivecards-designer.min.js"></script> -->
<script src="https://unpkg.com/adaptivecards-designer@latest/dist/adaptivecards-designer-standalone.min.js"></script>
<script type="text/javascript">
window.onload = function () {
let hostContainers = [];
let designer = new ACDesigner.CardDesigner(hostContainers);
designer.assetPath = "https://unpkg.com/adaptivecards-designer@latest/dist";
require.config({ paths: { 'vs': 'https://unpkg.com/monaco-editor@0.17.1/min/vs' } });
require(['vs/editor/editor.main'], function () {
designer.monacoModuleLoaded();
});
designer.attachTo(document.getElementById("designerRootHost"));
};
</script>

<body>
<div id="designerRootHost"></div>
</body>

</html>

最佳答案

monaco-editor 对加载模块的过程有影响,请更改顺序,先加载adaptivecards-designer

<!-- <script src="https://unpkg.com/adaptivecards-designer@latest/dist/adaptivecards-designer.min.js"></script> -->
<script src="https://unpkg.com/adaptivecards-designer@latest/dist/adaptivecards-designer-standalone.min.js"></script>
<script src="https://unpkg.com/monaco-editor@0.17.1/min/vs/loader.js"></script>

关于javascript - 未捕获的 ReferenceError : ACDesigner is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68452379/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com