将 BotUI 与 meteor.js 一起使用



我正在尝试在我的流星项目中使用 BotUI 框架并遵循安装指南,但似乎无法让它工作。无论我尝试哪种设置,我总是会遇到各种错误,对于以下我得到Uncaught TypeError: BotUI is not a constructor.

我的客户端/主.js文件:

//import Meteor stuff
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
//NPM packages
import Vue from 'vue'; //not necessary according to installation guide
import BotUI from 'botui';
//files
import './main.html';

Meteor.startup(() => {
var botui = new BotUI('my-botui-app');
botui.message.bot({
content: "Hello there!"
});
});

我的 client/main.html 文件:

<head>
<title>BotUI with Meteor</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
<div id="my-botui-app">
<bot-ui>     
</bot-ui>
</div>
</body>

我还尝试将文件本地包含在/imports中或使用 CDN 与$.getScript,但没有成功。

我错过了什么?

对于将来会遇到"BotUI 不是构造函数"问题的人,这与索引中缺少脚本和 css 有关.html,建议运行 BotUi 指令。

最新更新