Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including v-contextmenu with all npm packages installed. Try it out:

require("vue/package.json"); // vue is a peer dependency. var vContextmenu = require("v-contextmenu")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

v-contextmenu v2.9.0

ContextMenu based on Vue 2.0

v-contextmenu

NPM version Node version NPM download Dependencies License

NPM

适用于 Vue 2.0 的 ContextMenu 组件。

中文 | English

安装

CDN 引入

可通过 unpkg.com/v-contextmenu 获取最新版本的资源,在页面中引入相应 js 和 css 文件即可。

<!-- 引入 Vue -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>

<!-- 引入 VContextmenu 组件 -->
<script src="https://unpkg.com/v-contextmenu/dist/index.js"></script>

<!-- 引入 VContextmenu 组件样式 -->
<link rel="stylesheet" href="https://unpkg.com/v-contextmenu/dist/index.css">

建议使用 NPM 安装

NPM 安装

$ npm i -S v-contextmenu # yarn add v-contextmenu

概览

概览

访问在线示例查看在线示例 GIF

使用

一个简单的例子

import contentmenu from 'v-contextmenu'
import 'v-contextmenu/dist/index.css'

Vue.use(contentmenu)
<template>
  <v-contextmenu ref="contextmenu">
    <v-contextmenu-item>菜单1</v-contextmenu-item>
    <v-contextmenu-item>菜单2</v-contextmenu-item>
    <v-contextmenu-item>菜单3</v-contextmenu-item>
  </v-contextmenu>

  <div v-contextmenu:contextmenu>右键点击此区域</div>
</template>

详细使用方法见 文档 & 例子

如果你需要单独引入组件使用,请查看单独引用

主题

提供三种主题,使用方法见 VContextmenu

默认

default

亮色

bright

暗色

dark

开发

$ npm install
$ npm run dev

构建

$ npm run build:package # 构建 npm 包
$ npm run build:example # 构建示例站点
$ npm run build # build:package & build:example

更新日志

详见 releases

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free