npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-contextmenujs-lclick

v1.0.0

Published

Vue contextmenu , 基本原插件的修改

Downloads

1

Readme

Vue Contextmenu

原来的右键触发,改成左键触发了。 安装和配置和原组件相同。

CDN

<script src="https://unpkg.com/vue-contextmenujs/dist/contextmenu.umd.js">

使用

CDN引入则不需要 Vue.use(Contextmenu)

测试中使用的是element-ui图标

import Contextmenu from "vue-contextmenujs"
Vue.use(Contextmenu);
<template>
  <div id="app" style="width:100vw;height:100vh" @contextmenu.prevent="onContextmenu"></div>
</template>

<script>
export default {
  methods: {
    onContextmenu(event) {
      this.$contextmenu({
        items: [
          {
            label: "返回(B)",
            onClick: () => {
              this.message = "返回(B)";
              console.log("返回(B)");
            }
          },
          { label: "前进(F)", disabled: true },
          { label: "重新加载(R)", divided: true, icon: "el-icon-refresh" },
          { label: "另存为(A)..." },
          { label: "打印(P)...", icon: "el-icon-printer" },
          { label: "投射(C)...", divided: true },
          {
            label: "使用网页翻译(T)",
            divided: true,
            minWidth: 0,
            children: [{ label: "翻译成简体中文" }, { label: "翻译成繁体中文" }]
          },
          {
            label: "截取网页(R)",
            minWidth: 0,
            children: [
              {
                label: "截取可视化区域",
                onClick: () => {
                  this.message = "截取可视化区域";
                  console.log("截取可视化区域");
                }
              },
              { label: "截取全屏" }
            ]
          },
          { label: "查看网页源代码(V)", icon: "el-icon-view" },
          { label: "检查(N)" }
        ],
        event,
        //x: event.clientX,
        //y: event.clientY,
        customClass: "class-a",
        zIndex: 3,
        minWidth: 230
      });
      return false;
    }
  }
};
</script>

参数说明

Menu

| 属性 | 描述 | 类型 | 可选值 | 默认值 | | :----: | :----: | :----: | :----: | :----: | | items | 菜单结构信息 | MenuItem[] | — | — | | event | 鼠标事件信息 | Event | — | — | | x | 菜单显示X坐标, 存在event则失效 | number | — | 0 | | y | 菜单显示Y坐标, 存在event则失效 | number | — | 0 | | zIndex | 菜单样式z-index | number | — | 2 | | customClass | 自定义菜单class | string | — | — | | minWidth | 主菜单最小宽度 | number | — | 150 |

MenuItem

| 属性 | 描述 | 类型 | 可选值 | 默认值 | | :----: | :----: | :----: | :----: | :----: | | label | 菜单项名称 | string | — | — | | icon | 菜单项图标, 生成<i class="icon"></i>元素 | string | — | — | | disabled | 是否禁用菜单项 | boolean | — | false | | divided | 是否显示分割线 | boolean | — | false | | customClass | 自定义子菜单class | string | — | — | | minWidth | 子菜单最小宽度 | number | — | 150 | | onClick | 菜单项点击事件 | Function() | — | — | | children | 子菜单结构信息 | MenuItem[] | — | — |

fork的项目,做了修改,由右键改成了左键点击出菜单。