[关闭]
@2890594972 2017-12-29T07:33:26.000000Z 字数 1458 阅读 2289

element ui导航和路由

element-ui


第一步:结构布局

container知识
image_1c2g346f9sbd199cpk91u5s1arb9.png-50.2kB

效果
image_1c2g3e1km1ndu1abv4g1c8guek26.png-4.8kB

第二步:配置路由

image_1c2g7iotk1dc91c5l1p14lk3f8e3q.png-12.5kB

  1. 在el-menu-item,以index为直接路由
    第一步:在el-menu中,开启:router="true"
    第二步:在el-menu-item标签,直接给index路由地址
    image_1c2g7630ruvm18962ms1vmtej03d.png-54.4kB

  2. 在el-menu-item,以route为直接路由,将覆盖index
    第一步:在el-menu中,开启:router="true"
    第二步:在el-menu-item标签,路由地址赋值给:route="{path:'/nav01/item03'}"
    image_1c2g73svd1n5ria81c0njjp1vjf30.png-57.4kB

  3. 动态路由,以自定义事件作为路由,用this.router.push(url)调整路由
    image_1c2g82keu1h6pi5l1sfd7241vu647.png-35.5kB
    image_1c2g83lbv369uh0fa436h1e584k.png-13kB

  4. js动态渲染导航
    image_1c2givapu79j178m12rsjv1snh5h.png-56.9kB

  1. menuArr: [{
  2. 'icons': '/static/img/1.png',
  3. 'title': '订单管理',
  4. 'hasChild': false,
  5. 'index': '1',
  6. 'subItem': [{
  7. 'index': '1-1',
  8. 'title': '订单管理',
  9. 'component': 'myorder',
  10. 'hasChild': true
  11. }]
  12. },
  13. {
  14. 'icons': '/static/img/2.png',
  15. 'title': '财务管理',
  16. 'hasChild': false,
  17. 'index': '2',
  18. 'subItem': [{
  19. 'index': '2-1',
  20. 'title': '我的资产',
  21. 'component': '/managerCenter/MyOrder2',
  22. 'hasChild': true,
  23. }, {
  24. 'index': '2-2',
  25. 'title': '收支明细',
  26. 'component': '/managerCenter/MyOrder3',
  27. 'hasChild': true,
  28. }, {
  29. 'index': '2-3',
  30. 'title': '我的发票',
  31. 'component': '/managerCenter/MyOrder1',
  32. 'hasChild': true,
  33. }]
  34. },
  35. {
  36. 'icons': '/static/img/3.png',
  37. 'title': '产品管理',
  38. 'hasChild': false,
  39. 'index': '3',
  40. 'subItem': [{
  41. 'index': '3-1',
  42. 'title': '产品管理',
  43. 'component': 'management',
  44. 'hasChild': true,
  45. }, {
  46. 'index': '3-2',
  47. 'title': '发布产品',
  48. 'component': 'bidding',
  49. 'hasChild': true,
  50. }]
  51. },
  52. {
  53. 'icons': '/static/img/4.png',
  54. 'title': '企业中心',
  55. 'hasChild': false,
  56. 'index': '4',
  57. 'subItem': [{
  58. 'index': '4-1',
  59. 'title': '我的企业',
  60. 'component': 'myfirm',
  61. 'hasChild': true,
  62. }, {
  63. 'index': '4-2',
  64. 'title': '个人信息',
  65. 'component': 'myinform',
  66. 'hasChild': true,
  67. }, {
  68. 'index': '4-3',
  69. 'title': '员工管理',
  70. 'component': 'mystaff',
  71. 'hasChild': true,
  72. }]
  73. }
  74. ]
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注