element-plus [Component] [menu-item-group] el-menu的@close事件无法触发

w1e3prcc  于 2023-03-19  发布在  其他
关注(0)|答案(2)|浏览(236)

Bug Type: Component

Environment

  • Vue Version: 3.2.45
  • Element Plus Version: 2.2.28
  • Browser / OS: Edg/108.0.1462.76/ Windows 11 22H2
  • Build Tool: Vite

Reproduction

  • el-menu-item-group

Element Plus Playground

Steps to reproduce

<script setup>
const isCollapse = ref(true)
const handleOpen = (key, keyPath) => {
console.log(key, keyPath)
}
const handleClose = (key, keyPath) => {
console.log(key, keyPath)
console.log("Close");
}
</script>
<template>
  <el-radio-group v-model="isCollapse" style="margin-bottom: 20px">
    <el-radio-button :label="false">展开</el-radio-button>
    <el-radio-button :label="true">关闭</el-radio-button>
  </el-radio-group>
  <el-menu default-active="1" class="el-menu-vertical-demo" :collapse="isCollapse" @open="handleOpen"
    @close="handleClose">
  </el-menu>
</template>

使用这样的代码(官网上的例子也是一样),点击关闭按钮正常关闭el-menu但没有触发@close事件

What is Expected?

点击关闭触发el-menu的@close事件

What is actually happening?

没有触发@close事件

Additional comments

(empty)

8i9zcol2

8i9zcol21#

我认为准确来说collapse的切换应该是不该触发open。

@element-plus/backers WDYT?

erhoui1w

erhoui1w2#

对就是这个意思

相关问题