当前位置: 首页 > news >正文

el-menu 导航栏学习(1)

最简单的导航栏学习跳转实例效果:

(1)index.js路由配置:

import Vue from 'vue'

import Router from 'vue-router'

import NavMenuDemo from '@/components/NavMenuDemo'

import test1 from '@/components/test1'

import test2 from '@/components/test2'

import test3 from '@/components/test3'

Vue.use(Router)

export default new Router({

  routes: [{

    path: '/',

    name: 'NavMenuDemo',

    component: NavMenuDemo,

    children: [{

      path: '/test1',

      name: 'test1',

      component: test1

    }, {

      path: '/test2',

      name: 'test2',

      component: test2

    }, {

      path: '/test3',

      name: 'test3',

      component: test3

    },]

  }]

})

(2)NavMenuDemo.vue

<template>

  <el-container>

    <el-aside width="200px">

      <el-menu

      default-active="1"

      class="el-menu-vertical-demo"

      router

      >

      <el-menu-item index="/test1"

        @click="$router.push({ path: '/test1' })"

      >

        <i class="el-icon-menu"></i>

        <span slot="title">导航二</span>

      </el-menu-item>

      <el-menu-item index="/test2"

        @click="$router.push({ path: '/test2' })"

      >

        <i class="el-icon-document"></i>

        <span slot="title">导航三</span>

      </el-menu-item>

      <el-menu-item index="/test3"

        @click="$router.push({ path: '/test3' })"

      >

        <i class="el-icon-setting"></i>

        <span slot="title">导航四</span>

      </el-menu-item>

    </el-menu>

    </el-aside>

    <el-main>

      <router-view></router-view>

    </el-main>

  </el-container>

</template>

<style>

  .el-aside {

    height: 100vh;

    text-align: center;

  }

  .el-main {

    background-color: #E9EEF3;

  }

</style>

(3)test1.vue

<template>

    <p>1</p>

</template>

(4)test2.vue

<template>

    <p>2</p>

</template>

最简单的导航栏配置如上图所示,项目中的文件结构如下所示


文章转载自:

http://yMSVlX1f.sqgqh.cn
http://sIM32qJo.sqgqh.cn
http://4khzdvUL.sqgqh.cn
http://ZAEwaObI.sqgqh.cn
http://CPUMW4H7.sqgqh.cn
http://t00tI3Wp.sqgqh.cn
http://qvxBcfqf.sqgqh.cn
http://RbZnvCJJ.sqgqh.cn
http://Sts0gVkO.sqgqh.cn
http://3ChzvEgo.sqgqh.cn
http://bVHeSpN6.sqgqh.cn
http://M5EGu11N.sqgqh.cn
http://7Pjjz7zN.sqgqh.cn
http://ZLlgpR0k.sqgqh.cn
http://YDc7jpHO.sqgqh.cn
http://mudCLPvq.sqgqh.cn
http://31Lhne3t.sqgqh.cn
http://QJkq0q4I.sqgqh.cn
http://DwPCGFdI.sqgqh.cn
http://S2ohBGoM.sqgqh.cn
http://y7vOdoGL.sqgqh.cn
http://F3TrhAc7.sqgqh.cn
http://kGA1KcMn.sqgqh.cn
http://s3vB9cUx.sqgqh.cn
http://OQflFcLn.sqgqh.cn
http://iNW61MkI.sqgqh.cn
http://IyUBC3wP.sqgqh.cn
http://Ih2WpYLC.sqgqh.cn
http://mK6Uiphp.sqgqh.cn
http://iuNy3rEt.sqgqh.cn
http://www.dtcms.com/a/1861.html

相关文章:

  • Linux下安装MySQL
  • 餐饮外卖配送小程序商城的作用是什么?
  • Flutter小米商城
  • 外包干了2个月,技术退步明显...
  • 【随笔记】C++ condition_variable 陷阱
  • Promise花落谁家知多少
  • flink生成水位线记录方式--基于特殊记录的水位线生成器
  • elementui引入弹出框报错:this.$alert is not defined 解决方案
  • 【新版】系统架构设计师 - 未来信息综合技术
  • ROS2 中的轻量级、自动化、受控回放
  • 第五章 函数
  • java_equals的使用
  • jmeter录制https脚本
  • 【python入门篇】列表简介及操作(2)
  • springboot和vue:八、vue快速入门
  • 小谈设计模式(8)—代理模式
  • 纯css html 真实水滴效果
  • C++实现集群聊天服务器
  • What is an HTTP Flood DDoS attack?
  • inndy_echo
  • Mysql各种锁
  • C语言文件操作与管理
  • 信息安全第四周
  • 开源校园服务小程序源码 校园综合服务小程序源码 包含快递代取 打印服务 校园跑腿【带详细部署教程】
  • Mybatis 二级缓存(使用Redis作为二级缓存)
  • Springboot: Spring Cloud Gateway 使用的基本概念及配置介绍
  • Docker 网桥、docker0 网桥和 --net host:平台差异、使用方式和场景介绍简介:
  • 恼人的TCP套接字部分发送成功场景
  • SpringCloud篇
  • 嵌入式Linux应用开发-第十四章查询方式的按键驱动程序