Element UI手册:cloud.tencent.com/developer/d… 中文文档:element-cn.eleme.io/#/zh-CN github地址:github.com/ElemeFE/ele…


1:components 新建页面

2:打开app.vue 写代码

<template><div><el-col :span="2">   <el-menu:default-active="this.$route.path" router mode="horizontal"class="el-menu-vertical-demo"@open="handleOpen"@close="handleClose"background-color="#545c64"text-color="#fff"active-text-color="#ffd04b"><el-menu-item v-for="(item,i) in navList" :key="i" :index="item.name"><template slot="title"><i class="el-icon-s-platform"></i><span> {{ item.navItem }}</span></template></el-menu-item></el-menu></el-col><router-view     class="menu-right"/></div>
</template>
<script>export default {data() { return { navList:[ {name:'/components/ServiceHall',navItem:'服务大厅'}, {name:'/components/Management',navItem:'权限管理'},{name:'/components/User',navItem:'用户管理'}, {name:'/components/Personnel',navItem:'人员数据'}, {name:'/components/Alarm',navItem:'报警中心'}, ] } },methods: {handleOpen(key, keyPath) {console.log(key, keyPath);},handleClose(key, keyPath) {console.log(key, keyPath);}}}
</script><style>.menu-right{margin-left:200px;}</style>
复制代码

3:路由index.js

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import ServiceHall from '@/components/ServiceHall'
import Management from '@/components/Management'
import User from '@/components/User'
import Personnel from '@/components/Personnel'
import Alarm from '@/components/Alarm'Vue.use(Router)export default new Router({routes: [{path: '/',name: 'HelloWorld',component: HelloWorld},{path: '/components/ServiceHall',name: 'ServiceHall',component: ServiceHall}, {path: '/components/Management',name: 'Management',component: Management},{path: '/components/User',name: 'User',component: User},{path: '/components/Personnel',name: 'Personnel',component: Personnel},{path: '/components/Alarm',name: 'Alarm',component: Alarm}]
})复制代码

4:新页面的内容,我写的比较简单,需要自己写下功能需求所在的代码

<template>    <div>我是权限管理页面</div>
</template>
<script>
</script>
<style>
</style>
复制代码

5:效果就可以看了


原文作者:祈澈姑娘

转载于:https://juejin.im/post/5cebad495188253a2b01be20

vue导航栏跳转路由相关推荐

  1. element-ui使用导航栏跳转路由用法

    element-ui使用导航栏跳转路由用法 最近初学vue,试着做一个小项目熟悉语法与思想,其中使用elemen-ui的导航栏做路由跳转切换页面.下面记录一下学习过程 element-ui引入vue项 ...

  2. element ui路由配置文件_element-ui使用导航栏跳转路由的用法详解

    最近初学vue,试着做一个小项目熟悉语法与思想,其中使用elemen-ui的导航栏做路由跳转切换页面.下面记录一下学习过程 element-ui引入vue项目的用法参考 首先复制官网的例子,在这基础上 ...

  3. 写了个移动端可滑动(惯性滑动回弹)Vue导航栏组件 ly-tab

    前段时间写了一个移动端的自适应滑动Vue导航栏组件,觉得有一定实用性,大家可能会用得到(当然有些大佬自己写得更好的话就没必要啦),于是前两天整理了一下,目前已经发布到npm和GitHub上了,点我到n ...

  4. vue 导航栏刷新页面定位:

    不想分析可以直接看解决方案 问题描述: 通过router的route-link可以实现导航栏的功能,并且可以跳转到相应页面 但是刷新页面导航栏没有定位到当前页面一栏. 问题分析: 定位导航栏步骤 1. ...

  5. Vue导航栏吸顶及滚动渐变色

    @阿乐今天敲代码没 效果图 好几天没更新了,做一个小demo吧.导航栏吸顶,以及随页面滚动实现渐变色 吸顶前: 吸顶后: 滚动渐变色: 一.实现 html: <div class="n ...

  6. html导航栏页面切换的js,js实现页面滚动切换导航栏/点击导航栏跳转到指定位置...

    最近一直在弄页面的事情,对页面方面的知识又巩固了一下.这次的内容如题,大家对代码有疑问或者是有更好的方法欢迎留言! js部分 //标题对象 var title = document.getElemen ...

  7. vue导航栏滑动切换居中,导航栏超出部分可以滑动,点击触发滑动对应的index,且滑动时导航栏会自动对应

    效果图 模仿婚礼纪电子请帖模块 导航栏超出部分可以滑动,点击触发滑动对应的index,且滑动时导航栏会自动对应 Html部分  <template><div class=" ...

  8. js实现页面滚动切换导航栏/点击导航栏跳转到指定位置

    最近一直在弄页面的事情,对页面方面的知识又巩固了一下.这次的内容如题,大家对代码有疑问或者是有更好的方法欢迎留言! js部分 //标题对象       var title = document.get ...

  9. vue router.beforeEach跳转路由验证用户登录状态

    使用vue判断验证用户登录状态 导航钩子类似于生命周期钩子,包含路由进入前,进入后,更新时,退出前等几个周期,主要用于控制导航的前进后退或跳转等. 其中router.beforeEach就是路由进入前 ...

最新文章

  1. 8)排序①排序算法之交换排序[1]冒泡排序法
  2. XML 需要用的空间
  3. Xcode7查看iphone真机的应用程序文件
  4. MATLAB GPU编程基础
  5. 一张图看懂智联车管理云平台
  6. 学JAVA要学redis_新手学习Java对Redis简单操作
  7. JAVA中的枚举使用总结
  8. TF-tf.keras.layers.Dropout
  9. windows ghost系统下载
  10. JVM HotSpot 可达性分析算法实现细节
  11. rtthread学习之(2)——STM32 系列外设驱动添加指南
  12. Redhat之SSH
  13. 2014 你好,再见
  14. 清华计算机考研报考人数,2020部分院校考研报考人数统计
  15. 场景编程集锦 - BMI指数与健身达人
  16. PDE优化|逆问题中偏微分方程约束优化的惩罚方法(Matlab代码实现)
  17. OMAPL138的DSPLINK开发入门
  18. ubuntu系统vim常用命令学习以及ubuntu软件下载安装
  19. 用anacnda创建虚拟环境用不用指定python版本
  20. usb 键盘码表_ASCII码表,键盘按键码表,虚拟键盘按键码表

热门文章

  1. python散点图拟合曲线-Python解决最小二乘法拟合并绘制散点图
  2. 自学python当黑客-为什么黑客都用Python
  3. python代码大全p-21行Python代码实现拼写检查器
  4. 零基础学python全彩版实战答案-零基础学Python(全彩版)
  5. python语言入门m-Python入门基础三-函数
  6. python爬虫案例-python爬虫案例
  7. matlab溢出的标志inf,关于C#:溢出与信息
  8. 二分查找(递归和非递归)
  9. Linux基础命令-mkdir
  10. ASP.NET MVC过滤器(一)