<template>
  <div id="test">
    <p>test</p>
    <el-button @click="$router.push('/')">返回</el-button>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'test',
  props: {},
  components: {},
  data: function () {
    return {};
  },
  created() {
    this.$electron.ipcRenderer.removeAllListeners(process.env.VUE_APP_VIEW_LEAVE_VIEW_EVENT);
    // 建立离开的监听
    const ipcRenderer = this.$electron.ipcRenderer;
    ipcRenderer.on(process.env.VUE_APP_VIEW_LEAVE_VIEW_EVENT, (e, args) => {
      console.log('进程接收');
      // TODO,接着去干别的事,或停止考试,或累加次数
    });
  },
  methods: {},
  computed: {},
  beforeDestroy() {
    // 销毁离开的监听
    this.$electron.ipcRenderer.removeAllListeners(process.env.VUE_APP_VIEW_LEAVE_VIEW_EVENT);
  },
};
</script>

<style lang="less" scoped></style>
