<template>


</template>

<script>

export default {
    data() {
      return {
        cmdDataCallback:{//注册语音命令
          cmdDataFunc: "CmdDataCallback",//命令回调函数名
        },
      };
    },
    created() {
        if (robotType&&window.config.isRegisterVoice){
          window.config.isRegisterVoice=false;
          this.registerVoiceCMD()//注册语音
        }

      //将方法绑定到window下面，提供给外部调用
      window.CmdDataCallback = (res)=> this.CmdDataCallback(res);//注册语音
    },
    methods: {

      //注册语音
      registerVoiceCMD(){
        robotsdk.registerVoiceCMD(this.cmdDataCallback);//虚拟人物播放语音及动作
      },

      //语音回调
      CmdDataCallback(res){
          if (res=="scanning"){//扫描
            this.$emit('bPageLoaded',"scanning");
          }

          if (res=="nextStep"){//下一步
            this.$emit('bPageLoaded', "nextStep");
          }

          if (res=="quit"){//退出
            this.$emit('bPageLoaded', "quit");
          }
      },

    },
  };
</script>

<style scoped>

</style>
