右键菜单_右键菜单组件

<template>
  <!-- 右键菜单 -->
  <ul class="menu" v-show="show">
    <li
      :key="index"
      @click.stop.prevent="clickEvent(clickMenu.fnName)"
      class="menu-item"
      v-for="(clickMenu,index) in clickMenus"
    >
      <i class="menu-item-bg"></i>
      {{clickMenu.text}}
    </li>
  </ul>
</template>

<script>
export default {
  name: 'fyMenu',
  props: {
    menuShow: {
      type: Boolean,
      default: false,
    },
    clickMenus: {
      type: Array,
      default: () => {
        return []
      },
    },
    // 鼠标右键菜单
    contextmenu: {
      type: Object,
      default: function _default() {
        return { height: 0, width: -10 }
      },
    },
  },
  data() {
    return {
      show: this.menuShow,
    }
  },
  methods: {
    clickEvent(name) {
      this.$emit('clickEvent', name)
    },
  },
  watch: {
    menuShow(val) {
      this.show = val
    },
  },
}
</script>

<style lang="scss" scoped>
// 右键菜单样式
.menu {
  position: fixed;
  z-index: 999;
  width: 168px;
  box-sizing: border-box;
  font-size: $font-size-14;
  font-weight: $font-weight-400;
  border-radius: 2px;
  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  -ms-border-radius: 2px;
  -o-border-radius: 2px;
  background: $color-fcfcfc;
  box-shadow:0px 2px 4px 0px rgba(51,51,51,0.2);

  .menu-item {
    display: block;
    position: relative;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    min-width: 158px;
    line-height: 28px;
    padding-left: 40px;
    position: relative;

    cursor: pointer;

    .menu-item-bg {
      position: absolute;
      left: 30px;
      top: 0;
      display: block;
      width: 1px;
      height: 30px;
      background-color: #f0f0f2;
    }
  }
}
</style>

7b07b32aeb779c7d29bf7266eb53cc01.png

ddbcd87314aaf85c2bed92c847b5e5a3.png
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值