Installation - smellyshovel/vue-custom-context-menu GitHub Wiki

There're currently 2 possible ways to install the plugin:

Using build systems

The first one is for use in full-fledged web applications. Use npm/webpack/rollup/babel in your project? Then probably this one is for you!

  1. Just install the vue-custom-context-menu npm package

    $ npm install --save vue-custom-context-menu
  2. Then in your main file import the plugin

    import VCCM from "vue-custom-context-menu"

    or

    const VCCM = require("vue-custom-context-menu")

    The both options would work out precisely the same end result. Decide what to choose depending on what build system you use

  3. And the last thing is to make Vue use the plugin. In order to achieve that add Vue.use(VCCM) before the definition of your app's main instance. Your end main file should look something like the follows

    // import the Vue itself
    import Vue from 'vue';
    // import the main component
    import App from './App.vue';
    // import the plugin
    import VCCM from 'vue-custom-context-menu';
    
    // install the plugin
    Vue.use(VCCM);
    
    // and then define the main instance
    new Vue({
        render: h => h(App)
    }).$mount('#app');

Via the <script> tag

The second approach is suitable when you don't use any build system and want to simply link the plugin to a page in the form of a seperate script. Here you go then

<!-- Don't forget to include Vue! -->
<script src="unpkg.com/vue"></script>
<!-- And the plugin itself... -->
<script src="unpkg.com/vue-custom-context-menu"></script>

Note that using this approach you don't have to manually install the plugin using Vue.use(). It's done automatically for you

Cool, now that yor've installed the plugin you're finally ready to build your custom Context Menus 🎉! Consider the Usage section to find out how.

⚠️ **GitHub.com Fallback** ⚠️