<template>
  <div id="index">
    <el-row>
      <el-col :span="24" class="main">
        <el-col :span="24" class="btn">
          <el-button type="primary" size="mini" @click="openBtn">在线客服</el-button>
        </el-col>
      </el-col>
    </el-row>
    <el-dialog title="在线聊天" :visible.sync="show" width="40%" :before-close="close" :close-on-click-modal="false" :close-on-press-escape="false">
      <chat-frame></chat-frame>
    </el-dialog>
  </div>
</template>

<script>
import chatFrame from '@c/chat.vue';
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'index',
  props: {},
  components: {
    chatFrame,
  },
  data: function () {
    return {
      show: true,
    };
  },
  created() {},
  methods: {
    // 打开在线聊天
    openBtn() {
      this.show = true;
    },
    // 关闭在线聊天
    close() {
      this.show = false;
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
/deep/.el-dialog__body {
  padding: 10px;
  height: 500px;
  overflow: hidden;
}
</style>
