update Menu
This commit is contained in:
parent
f9a6a467a6
commit
2a7765f93d
2 changed files with 23 additions and 10 deletions
|
@ -102,7 +102,7 @@
|
|||
},
|
||||
methods: {
|
||||
// Ctrl or CMD and click, open in new window when use `to`
|
||||
handleClickLink (event, new_window) {
|
||||
handleClickLink (event, new_window = false) {
|
||||
this.$emit('click', event);
|
||||
|
||||
this.handleCheckClick(event, new_window);
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
<template>
|
||||
<a v-if="to" :href="linkUrl" :target="target" :class="classes" @click="handleClickItem" :style="itemStyle"><slot></slot></a>
|
||||
<a
|
||||
v-if="to"
|
||||
:href="linkUrl"
|
||||
:target="target"
|
||||
:class="classes"
|
||||
@click.exact="handleClickItem($event, false)"
|
||||
@click.ctrl="handleClickItem($event, true)"
|
||||
@click.meta="handleClickItem($event, true)"
|
||||
:style="itemStyle"><slot></slot></a>
|
||||
<li v-else :class="classes" @click.stop="handleClickItem" :style="itemStyle"><slot></slot></li>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -46,9 +54,13 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
handleClickItem (event) {
|
||||
handleClickItem (event, new_window = false) {
|
||||
if (this.disabled) return;
|
||||
|
||||
if (new_window) {
|
||||
// 如果是 new_window,直接新开窗口就行,无需发送状态
|
||||
this.handleCheckClick(event, new_window);
|
||||
} else {
|
||||
let parent = findComponentUpward(this, 'Submenu');
|
||||
|
||||
if (parent) {
|
||||
|
@ -57,7 +69,8 @@
|
|||
this.dispatch('Menu', 'on-menu-item-select', this.name);
|
||||
}
|
||||
|
||||
this.handleCheckClick(event);
|
||||
this.handleCheckClick(event, new_window);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
|
Loading…
Add table
Reference in a new issue