1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

Add sub-menu to context menu (#762)

This commit is contained in:
Elsio Sanchez 2021-04-21 17:28:26 -04:00 committed by GitHub
parent 4d6496f5c6
commit 0e698293c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,52 @@
<div style="margin-right: 5%;margin-top: 10%;">
<i :class="iconAction(action)" style="font-weight: bolder;" />
</div>
<div>
<el-dropdown
v-if="!isEmptyValue(action.childs)"
>
<span class="contents">
<b class="label">
{{ action.name }}
</b>
</span>
<p
class="description"
>
{{ $t('data.noDescription') }}
</p>
<el-dropdown-menu
slot="dropdown"
@command="handleCommand"
>
<el-dropdown-item
v-for="(childs, key) in action.childs"
:key="key"
:command="childs"
:divided="true"
>
<span class="contents">
<b class="label" @click="handleCommand(childs)">
{{ childs.name }}
</b>
</span>
<p
v-if="!isEmptyValue(childs.description)"
class="description"
>
{{ childs.description }}
</p>
<p
v-else
class="description"
>
{{ $t('data.noDescription') }}
</p>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<div
v-else
>
<span class="contents">
<b class="label">
{{ action.name }}
@ -224,6 +269,9 @@ export default {
this.runAction(action)
}
},
handleCommand(childs) {
this.runAction(childs)
},
clickReferences(reference) {
this.openReference(reference)
},