Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnathan Barrett committed Sep 13, 2018
0 parents commit f272dc7
Show file tree
Hide file tree
Showing 19 changed files with 15,750 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 1%
last 2 versions
not ie <= 8
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/essential',
'@vue/airbnb',
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
parserOptions: {
parser: 'babel-eslint',
},
};
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# vue-context-menu-popup

[![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)
[![Npm version](https://img.shields.io/npm/v/vue-context-menu-popup.svg?maxAge=2592000)](https://www.npmjs.com/package/vue-context-menu-popup)

## Usage

```HTML
<ContextMenu :text="hello"></ContextMenu>
```

```javascript
import { ContextMenu } from 'vue-context-menu-popup'

export default {
components: {
ContextMenu
}
}
```

## API

### context-menu

#### props

- `menu-items` ***Array*** (*optional*)

#### data

- `visible`

**initial value:** `false`

- `contextMenuPosition`

**initial value:** `[object Object]`

#### methods

- `close()`

- `open(position)`

## Installation

```
npm install vue-context-menu-popup
```

## Project setup

```
npm install
```

### Compiles and hot-reloads for development

```
npm run serve
```

### Compiles and minifies for production

```
npm run build
```

### Lints and fixes files

```
npm run lint
```

### Run your unit tests

```
npm run test:unit
```

### Update the API section of README.md with generated documentation

```
npm run doc:build
```
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app',
],
};
83 changes: 83 additions & 0 deletions example/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<template>
<div id="app">
<ContextMenu ref="contextMenu" :menu-items="[
{
label: 'First Menu Item',
handler: () => {this.consoleMessage.push('First Menu Item Clicked')}
},
{
label: 'Disabled Menu Item',
handler: () => {/* I don't do anything because I'm disabled ¯\_(ツ)_/¯ */},
disabled: true,
},
{
label: 'I have children',
children: [
{
label: 'Child Item 1',
handler: () => {this.consoleMessage.push('Child Item 1 Clicked')}
},
{
label: 'I also have children',
children: [
{
label: 'Child Item 2',
handler: () => {this.consoleMessage.push('Child Item 2 Clicked')}
}
]
}
]
}
]"/>

<div class="context-menu-trigger" @click.right.prevent="$refs.contextMenu.open($event)">
Right Click Me!
</div>

<div class="console" v-html="consoleMessage.length ? consoleMessage.join('<br>') : '...'"></div>

</div>
</template>

<script>
import ContextMenu from '@/components/ContextMenu.vue';
export default {
name: 'app',
data() {
return {
consoleMessage: [],
};
},
components: {
ContextMenu,
},
};
</script>

<style lang="scss">
body, html {
height: 100%;
}
#app {
margin-top: 60px;
font-family: arial, sans-serif;
}
.console {
background: #112300;
padding: 1em;
font-family: monospace;
line-height: 1.5em;
color: lawngreen;
text-shadow: 0 0 10px lawngreen;
}
.context-menu-trigger {
width: 50%;
margin: 2em auto;
padding: 2em;
background: #c0c0c0;
}
</style>
Binary file added example/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions example/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Vue from 'vue';
import App from './App.vue';

Vue.config.productionTip = false;

new Vue({
render: h => h(App),
}).$mount('#app');
Loading

0 comments on commit f272dc7

Please sign in to comment.