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-contextmenu-json

v1.1.8

Published

Vue-contextmenu component,use only with json data

Downloads

29

Readme

Vue-Contextmenu-json

A contextmenu component for Vue.The most thought i want to show is Use the contextmenu without template,you just need a json data and a directive which binds on the element.

Usage

in main.js

import VueContextMenu from 'vue-contextmenu-json';

Vue.use(VueContextmenu);

in *.vue

<template>
    <div>
        <anyElement v-contextmenu='{array:theArrayData,id:theIdYouWant}'></anyElement>
    </div>
</template>

<script>
    export default {
        data () {
            return {
                theArrayData:[
                    {name:'Operation 1',function:'funca',child:null},
                    {name:'Operation 2',function:'funca',child:[
                        {name:'Operation 2-1',function:'funca'}
                    ]}
                ]
            }
        },
        methods:{
            funca () {
                console.log(1);
            }
        }
    }
</script>

You can bind directive in any Template you want ,and you don't need to write the Contextmenu Template.

Modifiers

click
You can left click your element to show menu

<anyElement v-contextmenu.click='{...}'>

Parameter

|name|type|content| |:-|:-|:-| |array|Array|the json object which defined in your data function,every element is Object| |id|String|distinguish from more contextmenus in one vue template|

And the array parameter is

|name|type|content| |:-|:-|:-| |name|String|the contextmenu name| |function|String|the contextmenu operation you want to use,just the function name you defined in methods object.You can use this to be vue instance,and node to be the element you open contextmenu | |child|Array|the submenu or subsubsubsubmenu :) ,which should same format parameter|

Example

gifhome_755x385.gif

<template>
    <div>
        <ul v-contextmenu='{array:ctmArray,id:"c"}'>
            <li v-for='item in array' :key='item.name'>
                    {{item.name}}
            </li>
        </ul>
        <!--
        <button @click='comName = null'>button</button>
        <i-ctm  v-if='comName === "i-ctm"' :array='ctmArray'></i-ctm>
        -->
    </div>
</template>

<script>
import iCtm from './components/contextmenu/index.js'
export default {
    name:'app',
    components:{
        'i-ctm':iCtm
    },
    data () {
        return {
            comName:'i-ctm',
            array:[
                {name:'Li 1'},
                {name:'Li 2'}
            ],
            ctmArray:[
                {name:'button 1',function:'funca',child:[
                    {name:'1-1111111',function:'funca',child:[
                        {name:'1-1111-11111',function:'funca'}
                    ]}
                ]},
                {name:'button 2',function:'funca'},
                {name:'button 3',function:'funca'},
                {name:'button 4',function:'funca'}
            ]
        }
    },
    methods:{
        funca (node) {
            this.array.push({name:'Li 3'});
            console.log(node); //  the element you open contextmenu, like 'Li 3' li
        }
    }
}
</script>

Update Log

2019-09-09
完成左键鼠标点击仍可以实现弹窗功能

End

If you have any problem or thoughts you think will make this component better,please let me know .