在H5 IOS 中使用el-menu发现点击两次才会跳转

在H5 IOS 中使用el-menu发现点击两次才会跳转,UI如下,不仅仅是menu,el-select 也是点击两次才会选中,请问一下各位同仁这种情况要如何解决?

img

安卓没问题吗? 如果安卓也有 说明可能不是兼容性问题。可能是代码有问题。
检查是否有其他元素覆盖在el-menu或el-select上,导致点击事件无法直接触发。可以通过调整元素的层叠顺序或调整元素的位置来解决。

  • 这篇博客: el-menu导航鼠标移入背景色,字体颜色改变,及文字过长,显示省略号,鼠标悬停显示全文中的 二、上代码 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • <template>
      <div class="about">
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
        >
          <el-sub-menu index="1">
            <template #title>
              <el-icon>
                <location @click.stop="clickIcon" />
              </el-icon>
              <span
                style="display:block;width:90%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"
                :title="'Navigator NavigatorNavigatorNavigator One'"
              >Navigator NavigatorNavigatorNavigator One</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">item one</el-menu-item>
              <el-menu-item index="1-2">item one</el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group title="Group Two">
              <el-menu-item index="1-3">item three</el-menu-item>
            </el-menu-item-group>
            <el-sub-menu index="1-4">
              <template #title>item four</template>
              <el-menu-item index="1-4-1">item one</el-menu-item>
            </el-sub-menu>
          </el-sub-menu>
          <el-menu-item index="2">
            <el-icon>
              <icon-menu />
            </el-icon>
            <span>Navigator Two</span>
          </el-menu-item>
          <el-menu-item index="3" disabled>
            <el-icon>
              <document />
            </el-icon>
            <span>Navigator Three</span>
          </el-menu-item>
          <el-menu-item index="4">
            <el-icon>
              <setting />
            </el-icon>
            <span>Navigator Four</span>
          </el-menu-item>
        </el-menu>
      </div>
    </template>
    <script>
    import {
      Location,
      Document,
      Menu as IconMenu,
      Setting,
    } from '@element-plus/icons-vue'
    export default {
      name: 'About',
      components: {
        Location,
        Document,
        Setting,
        IconMenu
      },
      data() {
        return {
    
        }
      },
      methods: {
        handleOpen(key, keyPath) {
          key, keyPath
        },
        handleClose(key, keyPath) {
          key, keyPath
        },
        clickIcon() {
          console.log(123)
        }
      }
    }
    </script>
    <style scoped>
    .about {
      width: 200px;
    }
    /* 改变elementui 侧边栏移入颜色 */
    .about >>> .el-menu-item:hover {
      background: #1c88cf !important;
      color: #fff !important;
    }
    .about >>> .el-submenu__title:hover {
      background: #1c88cf !important;
      color: #fff !important;
    }
    .about >>> .el-menu-item.is-active {
      background: #1c88cf !important;
      color: #fff !important;
    }
    .about >>> .el-submenu__title.is-active {
      background: #1c88cf !important;
      color: #fff !important;
    }
    </style>