2
0
mirror of https://github.com/tenrok/vue-context.git synced 2026-05-23 23:54:03 +03:00
Randall Wilk f3160dfb92 Update readme
2019-04-03 10:12:23 -05:00
2018-05-29 21:24:51 -05:00
2018-06-20 08:03:33 -05:00
2018-10-23 12:47:26 -05:00
2018-05-26 11:43:23 -05:00
2018-11-19 08:19:34 -06:00
2018-10-15 08:59:35 -05:00
2018-06-25 07:45:27 -05:00
2018-05-26 11:43:23 -05:00
2018-06-25 07:47:15 -05:00
2018-11-19 08:30:58 -06:00
2018-05-29 19:52:27 -05:00
2018-06-20 08:59:37 -05:00
2018-05-26 11:43:23 -05:00
2018-11-19 08:24:09 -06:00
2018-11-19 08:24:09 -06:00
2019-04-03 10:12:23 -05:00

vue-context

npm version npm downloads GitHub issues GitHub stars VueJS version

vue-context provides a simple yet flexible context menu for Vue. It is styled for the standard <ul> tag, but any menu template can be used. The only dependencies the menu has are Vue and vue-clickaway, so the majority of styling is up to you, and any of the package styles for the menu can easily be overridden.

The menu disappears when you expect by utilizing vue-clickaway and it also optionally disappears when clicked on.

Screenshot

Note

The API has changed. Check v2.0.1 documentation if you use the old version.

Getting Started

The following instructions will help you get the vue-context menu up and running on your project.

Installation

Using npm:

npm i vue-context

Basic Usage

Import the component and use it in your app.

import Vue from 'vue';
import { VueContext } from 'vue-context';

new Vue({
    components: {
        VueContext
    },
    
    methods: {
        onClick (text) {
            alert(`You clicked ${text}!`);
        }
    }
}).$mount('#app');

Next add an element to the page that will trigger the context menu to appear, and also add the context menu to the page.

<div id="app">

    <div>
        <p @contextmenu.prevent="$refs.menu.open">
            Right click on me
        </p>    
    </div>
    
    <vue-context ref="menu">
        <ul>
            <li @click="onClick($event.target.innerText)">Option 1</li>
            <li @click="onClick($event.target.innerText)">Option 2</li>
        </ul>
    </vue-context>
    
</div>

Documentation/Demo

For full documentation and demos, go here: https://vue-context.randallwilk.com/docs

License

vue-context uses the MIT License (MIT). Please see the license file for more information.

S
Description
Контекстное меню
Readme MIT 3.1 MiB
Languages
JavaScript 48.1%
Vue 35.4%
HTML 12.3%
SCSS 4.2%