首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >放大Vue Chatbot不设置

放大Vue Chatbot不设置
EN

Stack Overflow用户
提问于 2020-03-27 15:34:32
回答 1查看 232关注 0票数 1

我试图在我的应用程序中使用Amplify组件,但我一直得到:

没有提供

聊天机器人。

我使用了扩容CLI来添加交互,这将正确的配置添加到aws-exports.js文件中。然后将Amplify.Configure设置为使用导出文件。

但是当我尝试在我的应用程序中使用这个组件时,我似乎无法让它运行。

App.vue

代码语言:javascript
复制
<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-出口

代码语言:javascript
复制
// 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

代码语言:javascript
复制
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')
EN

回答 1

Stack Overflow用户

发布于 2020-10-19 21:53:07

下面是您的app.vue的修改版本,这将有效:

代码语言:javascript
复制
<template>
  <amplify-chatbot v-bind:chatbotConfig="chatbotConfig"></amplify-chatbot>
</template>

<script>
import { Interactions } from 'aws-amplify';

export default {
  name: 'App',
  data: () => ({
   chatbotConfig:{
     bot: "addTheBotNameHere",
     clearComplete: true
    },
  }),
  mounted() {
   Interactions.onComplete("addTheBotNameHere", this.handleComplete);
},
  methods: {

    handleComplete(err,confirmation) {

      if(err) {
         alert("bot conversation failed");
         return;
      }

      return "Thank You";
    },
  },
};
</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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60889213

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档