Skip to content

Commit 57447fc

Browse files
author
Johnathan Barrett
committed
Added an indication to menu items that there are child items
1 parent f23f3f1 commit 57447fc

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"url": "https://github.com/Johnathan/vue-context-menu-popup/issues",
2020
"email": "johnathan.barrett@gmail.com"
2121
},
22-
"version": "1.0.1",
22+
"version": "1.0.2",
2323
"private": false,
2424
"scripts": {
2525
"serve": "vue-cli-service serve ./example/main.js --open",

src/components/ContextMenu.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ export default {
120120
padding: .5em 1em;
121121
cursor: pointer;
122122
123+
.label {
124+
display: flex;
125+
justify-content: space-between;
126+
white-space: nowrap;
127+
128+
.item-label {
129+
margin-right: 1em;
130+
}
131+
}
132+
123133
&.item-disabled {
124134
cursor: not-allowed;
125135
opacity: 0.3;
@@ -136,7 +146,7 @@ export default {
136146
left: calc(100% + 2px);
137147
top: 0;
138148
display: block;
139-
width: 100%;
149+
min-width: 100%;
140150
}
141151
}
142152
}

src/components/ContextMenuItem.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
22
<li @click="handleClick(item, $event)" :class="itemClass(item)">
3-
{{item.label}}
3+
<div class="label">
4+
<span class="item-label">{{item.label}}</span>
5+
<span class="children-indicator" v-if="item.children">▶</span>
6+
</div>
47
<ul class="context-menu" v-if="item.children">
58
<context-menu-item
69
v-for="(childItem, index) in item.children"

0 commit comments

Comments
 (0)