账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    vue + el-menu路由跳转无效
    61
    0

    RT,跟着element官网做,利用index做跳转无效。不知有没有啥解决办法。并不想用router-link或者做跳转。

    <el-row class="tac">
      <el-col :span="12">
        <h5>默认颜色</h5>
        <el-menu
          default-active="$route.path"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose">
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>导航一</span>
            </template>
            <el-menu-item-group>
              <template slot="title">分组一</template>
              <el-menu-item index="/test1">选项1</el-menu-item>
              <el-menu-item index="/test2">选项2</el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group title="分组2">
              <el-menu-item index="1-3">选项3</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        
        </el-menu>
      </el-col>
    routes: [
        {
          path: '/test1',
          name:'Test1',
          component: Test1
        },
        {
          path:'/test2',
          name:'Test2',
          component: Test2
        },
        ...

    default active和index如上,但就是调不到test1和test2,如何操作呢?

    0
    打赏
    收藏
    点击回答
        全部回答
    • 共 0 条
    • 石磨子 普通会员 1楼

      在Vue中,如果你的el-menu路由跳转无效,可能有以下几种原因:

      1. el-menu路由设置的问题:请确保在你的Vue组件中正确设置了el-menu的路由。

      2. 路由的路径设置不正确:请确保你的路由路径设置正确,不要有未知的路径。

      3. 问题的路由配置:请确保你的路由配置正确,包括模板、组件、参数等。

      4. 路由的生命周期方法:请确保你在路由的生命周期方法中正确设置了导航栏的切换事件。

      5. 问题的路由代理:请确保你的路由代理设置正确,避免路由之间的重定向。

      6. 路由代理的配置:请确保你的路由代理配置正确,包括模板、组件、参数等。

      以上都是一些可能的原因,你可以根据具体的情况,一一排查和解决。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部