<template>
  <div class="con-text-menu" :style="porstyle">
    <ul>
      <li @click="onRefeshClick">刷新</li>
      <li @click="onCloseRight">关闭右侧</li>
      <li @click="onCloseOther">关闭其他</li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'ConTextMenu',
  props: {
    index: {
      type: Number,
      default: undefined
    },
    porstyle: {
      type: Object,
      default: undefined
    },
    openVisible: {
      type: Function,
      default: undefined
    }
  },
  methods: {
    onRefeshClick() {
      this.$router.go(0)
    },
    onCloseRight() {
      let componentInstance = this.$parent.$parent.$parent.$parent.$parent.$children[1].$children[0].$children[0].$vnode.parent.componentInstance
      this.$store.commit('app/removeTagsView', { type: 'right', index: this.index, componentInstance })
      if (this.openVisible) {
        this.openVisible()
      }
    },
    onCloseOther() {
      let componentInstance = this.$parent.$parent.$parent.$parent.$parent.$children[1].$children[0].$children[0].$vnode.parent.componentInstance
      this.$store.commit('app/removeTagsView', { type: 'other', index: this.index, componentInstance })
      if (this.openVisible) {
        this.openVisible()
      }
    }
  }
}
</script>

<style lang="scss">
@import './index.scss';
</style>
