Skip to content

Commit f272dc7

Browse files
author
Johnathan Barrett
committed
Initial Commit
0 parents commit f272dc7

File tree

19 files changed

+15750
-0
lines changed

19 files changed

+15750
-0
lines changed

.browserslistrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> 1%
2+
last 2 versions
3+
not ie <= 8

.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
},
6+
extends: [
7+
'plugin:vue/essential',
8+
'@vue/airbnb',
9+
],
10+
rules: {
11+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
12+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
13+
},
14+
parserOptions: {
15+
parser: 'babel-eslint',
16+
},
17+
};

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
.vscode
17+
*.suo
18+
*.ntvs*
19+
*.njsproj
20+
*.sln
21+
*.sw*

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# vue-context-menu-popup
2+
3+
[![GitHub open issues](https://img.shields.io/github/issues/Johnathan Barrett/vue-context-menu-popup.svg?maxAge=2592000)](https://github.com/Johnathan Barrett/vue-context-menu-popup/issues)
4+
[![Npm version](https://img.shields.io/npm/v/vue-context-menu-popup.svg?maxAge=2592000)](https://www.npmjs.com/package/vue-context-menu-popup)
5+
6+
## Usage
7+
8+
```HTML
9+
<ContextMenu :text="hello"></ContextMenu>
10+
```
11+
12+
```javascript
13+
import { ContextMenu } from 'vue-context-menu-popup'
14+
15+
export default {
16+
components: {
17+
ContextMenu
18+
}
19+
}
20+
```
21+
22+
## API
23+
24+
### context-menu
25+
26+
#### props
27+
28+
- `menu-items` ***Array*** (*optional*)
29+
30+
#### data
31+
32+
- `visible`
33+
34+
**initial value:** `false`
35+
36+
- `contextMenuPosition`
37+
38+
**initial value:** `[object Object]`
39+
40+
#### methods
41+
42+
- `close()`
43+
44+
- `open(position)`
45+
46+
## Installation
47+
48+
```
49+
npm install vue-context-menu-popup
50+
```
51+
52+
## Project setup
53+
54+
```
55+
npm install
56+
```
57+
58+
### Compiles and hot-reloads for development
59+
60+
```
61+
npm run serve
62+
```
63+
64+
### Compiles and minifies for production
65+
66+
```
67+
npm run build
68+
```
69+
70+
### Lints and fixes files
71+
72+
```
73+
npm run lint
74+
```
75+
76+
### Run your unit tests
77+
78+
```
79+
npm run test:unit
80+
```
81+
82+
### Update the API section of README.md with generated documentation
83+
84+
```
85+
npm run doc:build
86+
```

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/app',
4+
],
5+
};

example/App.vue

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<template>
2+
<div id="app">
3+
<ContextMenu ref="contextMenu" :menu-items="[
4+
{
5+
label: 'First Menu Item',
6+
handler: () => {this.consoleMessage.push('First Menu Item Clicked')}
7+
},
8+
{
9+
label: 'Disabled Menu Item',
10+
handler: () => {/* I don't do anything because I'm disabled ¯\_(ツ)_/¯ */},
11+
disabled: true,
12+
},
13+
{
14+
label: 'I have children',
15+
children: [
16+
{
17+
label: 'Child Item 1',
18+
handler: () => {this.consoleMessage.push('Child Item 1 Clicked')}
19+
},
20+
{
21+
label: 'I also have children',
22+
children: [
23+
{
24+
label: 'Child Item 2',
25+
handler: () => {this.consoleMessage.push('Child Item 2 Clicked')}
26+
}
27+
]
28+
}
29+
]
30+
}
31+
]"/>
32+
33+
<div class="context-menu-trigger" @click.right.prevent="$refs.contextMenu.open($event)">
34+
Right Click Me!
35+
</div>
36+
37+
<div class="console" v-html="consoleMessage.length ? consoleMessage.join('<br>') : '...'"></div>
38+
39+
</div>
40+
</template>
41+
42+
<script>
43+
import ContextMenu from '@/components/ContextMenu.vue';
44+
45+
export default {
46+
name: 'app',
47+
data() {
48+
return {
49+
consoleMessage: [],
50+
};
51+
},
52+
components: {
53+
ContextMenu,
54+
},
55+
};
56+
</script>
57+
58+
<style lang="scss">
59+
body, html {
60+
height: 100%;
61+
}
62+
63+
#app {
64+
margin-top: 60px;
65+
font-family: arial, sans-serif;
66+
}
67+
68+
.console {
69+
background: #112300;
70+
padding: 1em;
71+
font-family: monospace;
72+
line-height: 1.5em;
73+
color: lawngreen;
74+
text-shadow: 0 0 10px lawngreen;
75+
}
76+
77+
.context-menu-trigger {
78+
width: 50%;
79+
margin: 2em auto;
80+
padding: 2em;
81+
background: #c0c0c0;
82+
}
83+
</style>

example/assets/logo.png

6.69 KB
Loading

example/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Vue from 'vue';
2+
import App from './App.vue';
3+
4+
Vue.config.productionTip = false;
5+
6+
new Vue({
7+
render: h => h(App),
8+
}).$mount('#app');

0 commit comments

Comments
 (0)