slide.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div class="slide-layout nav-menu">
  3. <div class="navigator_menu">
  4. <span>导航面板</span>
  5. </div>
  6. <el-menu text-color="#999" active-text-color="#333" class="el-menu-vertical-demo" @select='handleSelect'>
  7. <template v-for="(nav, i) in navs">
  8. <router-link tag="div" :to="nav.link" :key="i" v-if="!nav.children">
  9. <el-menu-item :index="i+''" style="padding-left: 49px;">
  10. <i class="iconfonts i-fix" :style="{backgroundPosition: '0px -'+(Number(actice_idx)===i?nav.top + 14:nav.top)+'px'}"></i>
  11. <span slot="title">{{nav.text}}</span>
  12. </el-menu-item>
  13. </router-link>
  14. <el-submenu v-else :key="i" :index="i+''">
  15. <template slot="title">
  16. <i class="iconfonts i-fix" :style="{backgroundPosition: '0px -'+nav.top+'px'}"></i>
  17. <span style="padding-left:30px">{{nav.text}}</span>
  18. </template>
  19. <router-link tag="div" :to="nav.link" v-for="(nav, j) in nav.children" :key="j">
  20. <el-menu-item :index="i+'-'+j">{{nav.text}}</el-menu-item>
  21. </router-link>
  22. </el-submenu>
  23. </template>
  24. </el-menu>
  25. </div>
  26. </template>
  27. <script>
  28. export default {
  29. name: 'm-aside',
  30. component: {},
  31. data () {
  32. let navs = [
  33. { text: '首页', link: {name: 'Home'}, top: 14 },
  34. { text: '订单管理', link: {name: 'Order'}, top: 42 },
  35. // { text: '增值服务', link: {name: 'Added'}, top: 70 },
  36. // {
  37. // text: '代理平台',
  38. // link: {name: 'home'},
  39. // children: [
  40. // { text: '代理管理', link: {name: 'hone'} },
  41. // { text: '代理查询', link: {name: 'hone'} },
  42. // { text: '公告设置', link: {name: 'hone'} }
  43. // ],
  44. // top: 98
  45. // },
  46. { text: '设备管理', link: {name: 'device'}, top: 126 },
  47. { text: '发票管理', link: {name: 'invoice'}, top: 126 },
  48. {
  49. text: '更多设置',
  50. link: {name: 'home'},
  51. children: [
  52. { text: '场景管理', link: {name: 'scene'} },
  53. { text: '反馈消息', link: {name: 'feedback'} },
  54. { text: '设备管理', link: {name: 'device'} },
  55. { text: '客户管理', link: {name: 'client'} }
  56. ],
  57. top: 154
  58. },
  59. { text: '经销商申请', link: {name: 'distributor-list'}, top: 98 },
  60. { text: '留言管理', link: {name: 'leaving'}, top: 182 },
  61. { text: '版本管理', link: {name: 'edition'}, top: 182 },
  62. { text: '数据统计', link: {name: 'Statistics'}, top: 210 }
  63. // { text: '数据下载', link: {name: 'Down'}, top: 210 }
  64. // ,
  65. // {
  66. // text: 'BBS',
  67. // link: {name: 'home'},
  68. // children: [
  69. // { text: '文章列表', link: {name: 'home'} },
  70. // { text: '评论管理', link: {name: 'home'} },
  71. // { text: '用户管理', link: {name: 'home'} }
  72. // ],
  73. // top: 182
  74. // }
  75. ]
  76. return {
  77. actice_idx: 1,
  78. navs: navs
  79. }
  80. },
  81. methods: {
  82. handleSelect (key) {
  83. console.log(key)
  84. this.actice_idx = key
  85. },
  86. openNotice () {
  87. this.$store.commit('SET_OPENNOTICE', true)
  88. }
  89. }
  90. }
  91. </script>
  92. <style scoped>
  93. .slide-layout {
  94. border: 1px solid #ebeef5;
  95. background: #ffffff;
  96. z-index: 1;
  97. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  98. }
  99. .nav-menu {
  100. padding-left: 5px;
  101. user-select: none;
  102. font-size: 20px;
  103. }
  104. .nav-menu-item {
  105. margin: 20px 0;
  106. }
  107. .menu-title {
  108. font-size: 18px;
  109. margin-left: 15px;
  110. }
  111. .jiantou {
  112. width: 8px;
  113. height: 8px;
  114. border-top: 2px solid #000;
  115. border-right: 2px solid #000;
  116. transform: rotate(135deg);
  117. display: inline-block;
  118. margin-left: 64px;
  119. }
  120. .flex-item {
  121. cursor: pointer;
  122. display: flex;
  123. align-items: center;
  124. transition: all 0.3s;
  125. }
  126. .flex-item-list {
  127. margin-left: 32px;
  128. margin-top: 20px;
  129. }
  130. .flex-item-list li {
  131. cursor: pointer;
  132. margin-top: 20px;
  133. color: #999;
  134. }
  135. .fade-enter-active,
  136. .fade-leave-active {
  137. transition: opacity .5s;
  138. }
  139. .fade-enter,
  140. .fade-leave-to
  141. /* .fade-leave-active below version 2.1.8 */
  142. {
  143. opacity: 0;
  144. }
  145. .iconfont {
  146. margin-right: 10px;
  147. }
  148. .navigator_menu {
  149. line-height: 56px;
  150. height: 56px;
  151. }
  152. .navigator_menu>span {
  153. padding-left: 20px;
  154. font-size: 12px;
  155. color: #999;
  156. }
  157. </style>
  158. <style type="text/css">
  159. .el-menu-item.is-active {
  160. background: #f2f2f2;
  161. /*color: #333;*/
  162. }
  163. .i-fix {
  164. display: inline-block;
  165. background-repeat: no-repeat;
  166. width: 14px;
  167. height: 14px;
  168. vertical-align: middle;
  169. background-image: url('~@/assets/images/icon/sys_icon.png')
  170. }
  171. .iconfonts {
  172. position: absolute;
  173. left: 20px;
  174. top: 50%;
  175. margin-top: -9px;
  176. }
  177. </style>