【发布时间】:2020-03-27 15:34:32
【问题描述】:
我正在尝试在我的应用程序中使用 Amplify Chatbot 组件,但我不断收到:
聊天机器人 - 未提供聊天机器人。
我使用 Amplify CLI 添加交互,将正确的配置添加到 aws-exports.js 文件中。然后我将 Amplify.Configure 设置为使用导出文件。
但是当我尝试在我的应用中使用该组件时,我似乎无法让它运行。
App.vue
<template>
<amplify-chatbot ></amplify-chatbot>
</template>
<script>
import { Interactions } from 'aws-amplify';
export default {
name: 'App',
components: {
Interactions
},
data(){
return {
}
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
AWS 出口
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = {
"aws_project_region": "eu-west-1",
"aws_cognito_identity_pool_id": "eu-west-1:fbc545c0-ddac-410b-8f8d-4ba3cffadbb2",
"aws_cognito_region": "eu-west-1",
"oauth": {},
"aws_bots": "enable",
"aws_bots_config": [
{
"name": "ScheduleAppointment_dev",
"alias": "$LATEST",
"region": "eu-west-1"
}
]
};
export default awsmobile;
main.js
import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import Amplify, * as AmplifyModules from 'aws-amplify'
import { AmplifyPlugin } from 'aws-amplify-vue'
import awsconfig from './aws-exports'
Amplify.configure(awsconfig)
Vue.use(AmplifyPlugin, AmplifyModules)
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
【问题讨论】:
-
我从未使用过 aws-amplify,所以这是在黑暗中拍摄,但我没有看到您在任何地方使用
awsmobile(我看到它已定义,但未在任何地方导入和使用) . -
嘿 AlaxMA,感谢您的评论,甚至另一双眼睛也有帮助。我有 main.js 导入 aws-exports 文件,我将它添加到上面,这样更清楚:)
标签: vue.js aws-amplify amazon-lex