Skip to content

Commit 634ec29

Browse files
Add divider option
1 parent bf63a8f commit 634ec29

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ Note - make sure to use `@click.prevent.stop` (or `@contextmenu.prevent.stop` fo
9595

9696
| prop | type | description | required |
9797
|---------|-------|--------------------------------|---|
98-
| elementId | String | Unique String that acts as the id of your menu. | Yes |
99-
| options | Array | Array of menu options to show. Component will use the `name` parameter as the label. | Yes |
100-
| options.name | Array | Label for the option. | Yes |
101-
| options.class | String | A custom class that will be applied to the option. | No |
102-
| ref | String | Unique String that allows you to show the menu on command. | Yes |
98+
| elementId | String | Unique String that acts as the id of your menu. | Yes |
99+
| options | Array | Array of menu options to show. Component will use the `name` parameter as the label. | Yes |
100+
| options.name | Array | Label for the option. | Yes |
101+
| options.class | String | A custom class that will be applied to the option. | No |
102+
| options.type | String | Only one possible value at the moment - `divider`. Pass this to set the object as a divider. | No |
103+
| ref | String | Unique String that allows you to show the menu on command. | Yes |
103104

104105
### Methods
105106

@@ -115,7 +116,7 @@ Note - make sure to use `@click.prevent.stop` (or `@contextmenu.prevent.stop` fo
115116

116117
### SASS Structure
117118

118-
```sass
119+
```scss
119120
.vue-simple-context-menu {
120121
&--active {
121122
}

example/App.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ export default {
163163
name: 'Duplicate',
164164
slug: 'duplicate'
165165
},
166+
{
167+
type: 'divider'
168+
},
166169
{
167170
name: 'Edit',
168171
slug: 'edit'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-simple-context-menu",
3-
"version": "3.2.0",
3+
"version": "3.3.0",
44
"description": "Simple context-menu component built for Vue. Works well with both left and right clicks. Nothing too fancy, just works and is simple to use.",
55
"author": "John Datserakis <johndatserakis@gmail.com>",
66
"license": "MIT",

src/vue-simple-context-menu.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:key="index"
1111
@click.stop="optionClicked(option)"
1212
class="vue-simple-context-menu__item"
13-
:class="option.class"
13+
:class="[option.class, (option.type === 'divider' ? 'vue-simple-context-menu__divider' : '')]"
1414
>
1515
{{option.name}}
1616
</li>
@@ -146,6 +146,14 @@ $black: #333;
146146
}
147147
}
148148
149+
&__divider {
150+
height: 10px;
151+
background-color: $grey;
152+
padding: 4px 0;
153+
background-clip: content-box;
154+
pointer-events: none;
155+
}
156+
149157
// Have to use the element so we can make use of `first-of-type` and
150158
// `last-of-type`
151159
li {

0 commit comments

Comments
 (0)