index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="btn">
  6. <el-button type="primary" size="mini" @click="openBtn">在线客服</el-button>
  7. </el-col>
  8. </el-col>
  9. </el-row>
  10. <el-dialog title="在线聊天" :visible.sync="show" width="40%" :before-close="close" :close-on-click-modal="false" :close-on-press-escape="false">
  11. <chat-frame></chat-frame>
  12. </el-dialog>
  13. </div>
  14. </template>
  15. <script>
  16. import chatFrame from '@c/chat.vue';
  17. import { mapState, createNamespacedHelpers } from 'vuex';
  18. export default {
  19. name: 'index',
  20. props: {},
  21. components: {
  22. chatFrame,
  23. },
  24. data: function () {
  25. return {
  26. show: true,
  27. };
  28. },
  29. created() {},
  30. methods: {
  31. // 打开在线聊天
  32. openBtn() {
  33. this.show = true;
  34. },
  35. // 关闭在线聊天
  36. close() {
  37. this.show = false;
  38. },
  39. },
  40. computed: {
  41. ...mapState(['user']),
  42. },
  43. metaInfo() {
  44. return { title: this.$route.meta.title };
  45. },
  46. watch: {
  47. test: {
  48. deep: true,
  49. immediate: true,
  50. handler(val) {},
  51. },
  52. },
  53. };
  54. </script>
  55. <style lang="less" scoped>
  56. /deep/.el-dialog__body {
  57. padding: 10px;
  58. height: 500px;
  59. overflow: hidden;
  60. }
  61. </style>